<div dir="ltr"><div><div><div><div><div><div><div>Caro Fernando (e demais colegas)<br><br></div>Gostaria de agradecer sua grande ajuda, mas preciso tirar mais outras dúvidas.<br></div>Abaixo está o código completo e a matriz dados que é base para os cálculos.<br></div>A saída que inseri é a coluna resultado [,1]<br><br></div>Porque não consigo calcular a média dos valores?<br></div>As saídas serão usadas como vetores (individualmente) em um outro procedimento para uso do pacote "sem" (Modelagem de equações estruturais).<br></div>Como tira as aspas, ou não tem nada a ver?<br></div><div>Porque aparecem valores 4500 e 3500 no meio dos calculados? (Não tem lógica)<br></div><br>setwd("C:/Dados")<br>dados <- read.table("Dados_Boot_txt.txt", h=T)<br><br>dados<br><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:currentcolor;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="gmail-GGHFMYIBCPB gmail-ace_keyword" style="color:blue;white-space:pre">> </span><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:blue">dados
</span>   X4 X5 X15 X6 X11 X12 X13 X16 X17 X18 X19 X20 X25 X26 X27 X29
1   3  4   3  2   3   4   4   2   3   3   3   5   3   4   3   3
2   2  5   5  5   3   5   5   4   5   4   5   4   4   3   5   3
3   4  5   4  3   5   5   5   4   5   6   6   5   4   4   5   4
4   2  6   4  4   2   6   6   4   4   3   6   6   3   4   4   2
5   4  3   1  3   1   4   5   3   3   1   3   1   2   1   2   1
6   5  5   6  5   5   6   6   6   5   5   6   4   5   5   5   4
7   1  7   4  5   7   6   7   5   4   5   5   3   4   4   7   6
8   5  7   6  5   4   6   6   3   7   5   4   3   5   7   5   6
9   5  6   4  3   5   5   5   4   4   4   3   2   2   5   2   5
10  3  6   2  5   5   6   6   6   4   4   5   5   2   2   6   3
11  2  2   3  2   2   4   4   4   3   4   5   4   5   3   4   3
12  2  3   2  2   3   2   5   3   2   4   5   2   4   5   3   2
13  7  7   4  3   3   6   7   6   6   6   6   6   4   4   6   5
14  5  7   6  6   7   6   6   7   7   6   5   5   3   4   6   6
15  3  6   5  6   5   6   6   5   6   6   5   5   4   4   6   6
16  1  2   1  4   1   5   2   2   3   6   5   4   1   2   1   1
17  4  5   2  4   3   4   3   5   5   4   3   3   2   4   3   4
18  5  6   5  5   3   5   5   6   7   6   6   5   4   3   6   6
19  4  3   5  3   1   5   4   2   3   4   4   5   1   4   2   5
20  3  3   3  4   4   3   4   2   2   3   3   3   2   3   1   2</pre><br>mean(dados[,1])<br><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:currentcolor;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="gmail-GGHFMYIBCPB gmail-ace_keyword" style="color:blue;white-space:pre">> </span><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:blue">mean(dados[,1])
</span>[1] 3.5</pre><br>library(sem)<br>library(boot)<br><br>#Bootstrap (médias das replicações)<br><br>obs <- function(x){<br>  <br>       results <- c()<br>       for(i in 1:500){<br>           <br>           results[i] <- mean(sample(dados,replace=T))<br>           saida <- paste(results,i,sep="")<br>           <br>       }<br>   <br>return(saida)<br>}<br><br>resultado<-apply(dados,2,obs)<br><br>resultado[,1]<br><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:currentcolor;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="gmail-GGHFMYIBCPB gmail-ace_keyword" style="color:blue;white-space:pre">> </span><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:blue">resultado[,1]
</span>  [1] "3.75500" "4.1500"  "4.05500" "3.5500"  "3.8500"  "4.1500"  "3.45500" "4.75500"
  [9] "4.25500" "3.45500" "3.6500"  "3.85500" "3.9500"  "4.05500" "3.6500"  "3.75500"
 [17] "4.2500"  "4.4500"  "3.65500" "4.2500"  "4500"    "4.15500" "5.05500" "3.75500"
 [25] "3.8500"  "4.45500" "4.25500" "3.65500" "3.65500" "4.05500" "4.05500" "3.3500" 
 [33] "3.4500"  "4.15500" "3.15500" "3.8500"  "3.7500"  "4.3500"  "4500"    "3.15500"
 [41] "4.55500" "3.95500" "4.1500"  "4.05500" "4.2500"  "3.6500"  "3.95500" "4.35500"
 [49] "3.65500" "4.75500" "3.7500"  "3.65500" "3.6500"  "4.85500" "3.8500"  "3.05500"
 [57] "3.85500" "3.8500"  "3.8500"  "3.35500" "3.7500"  "4.25500" "4.25500" "3.8500" 
 [65] "3.95500" "3.25500" "3.9500"  "3.75500" "3.7500"  "4.45500" "3.65500" "3.4500" 
 [73] "4500"    "4500"    "3.55500" "3.9500"  "3.75500" "4.3500"  "3.3500"  "4.25500"
 [81] "4.1500"  "4.2500"  "4.2500"  "4.2500"  "3.95500" "4.15500" "4.35500" "4.1500" 
 [89] "4.1500"  "4.05500" "3.9500"  "3.65500" "3.4500"  "3.65500" "4.15500" "3.35500"
 [97] "3.55500" "3.75500" "3.8500"  "3.8500"  "4.25500" "4.15500" "4500"    "3.95500"
[105] "3.95500" "3.65500" "4.4500"  "3.6500"  "3.75500" "3.55500" "3.9500"  "4.3500" 
[113] "3.9500"  "3.55500" "3.35500" "4.1500"  "3.65500" "3.75500" "3.6500"  "3.05500"
[121] "4500"    "3.9500"  "4.05500" "3.65500" "4.15500" "4.25500" "4500"    "4.05500"
[129] "4.7500"  "3.1500"  "3.2500"  "3.85500" "3.5500"  "3.5500"  "4.4500"  "3.45500"
[137] "3.7500"  "3.65500" "4.1500"  "4.05500" "3.35500" "4.1500"  "3.9500"  "3.1500" 
[145] "4.2500"  "4.15500" "4.45500" "3.95500" "3.25500" "3.9500"  "3.9500"  "3.75500"
[153] "3.65500" "3.6500"  "3.5500"  "3.65500" "3.9500"  "4.05500" "4.05500" "3.85500"
[161] "4.05500" "3.45500" "3.05500" "3.45500" "4.3500"  "4.6500"  "3.8500"  "4.35500"
[169] "4.05500" "4.1500"  "4.15500" "4.8500"  "3.6500"  "3.05500" "4500"    "3.95500"
[177] "3.6500"  "4.4500"  "4.25500" "4.35500" "3.6500"  "4.2500"  "3.9500"  "4.55500"
[185] "3.9500"  "4.3500"  "4.15500" "3.35500" "3.6500"  "3.9500"  "3.85500" "3.45500"
[193] "3.65500" "3.45500" "3.7500"  "3.45500" "4.3500"  "3.7500"  "3.4500"  "3.55500"
[201] "3.75500" "3.85500" "3.8500"  "4.65500" "3.8500"  "3.6500"  "3.7500"  "3.45500"
[209] "3.65500" "4.2500"  "3.5500"  "3.75500" "4.4500"  "3.8500"  "3.45500" "3.5500" 
[217] "4.5500"  "4.1500"  "3.85500" "3.6500"  "3.15500" "4.55500" "3.5500"  "3.65500"
[225] "3.8500"  "4500"    "4.15500" "3.65500" "3.35500" "3.5500"  "3.45500" "3.65500"
[233] "3.5500"  "4.1500"  "3.5500"  "4.15500" "4.15500" "4.15500" "4.2500"  "4.05500"
[241] "4.15500" "3.8500"  "3.85500" "4.05500" "4.1500"  "3.75500" "3.75500" "3.9500" 
[249] "3.25500" "4.15500" "3.85500" "4.25500" "4500"    "3.9500"  "4.15500" "4500"   
[257] "3.9500"  "3.95500" "4500"    "4.1500"  "3.8500"  "4.5500"  "4.4500"  "3.9500" 
[265] "3.95500" "4.4500"  "3.65500" "3.5500"  "4500"    "3.8500"  "3.4500"  "4.2500" 
[273] "3.05500" "3.6500"  "3.6500"  "4.2500"  "3.4500"  "3.55500" "4.25500" "3.95500"
[281] "3.4500"  "3.9500"  "4500"    "4.05500" "3.75500" "3.85500" "3.95500" "4.3500" 
[289] "3.1500"  "4.35500" "3.75500" "3.25500" "3.95500" "3.65500" "3.75500" "4.45500"
[297] "4.2500"  "4.2500"  "3.8500"  "4500"    "3.3500"  "4.3500"  "3.6500"  "4.25500"
[305] "3.45500" "3.65500" "5.05500" "4.1500"  "3.85500" "4.1500"  "3.8500"  "3.65500"
[313] "3.55500" "4.05500" "3.45500" "3.8500"  "4.15500" "3.3500"  "3.85500" "4.45500"
[321] "4.05500" "3.8500"  "3.6500"  "4.65500" "3.95500" "3.55500" "3.7500"  "3.95500"
[329] "3.8500"  "3.7500"  "3.55500" "3.95500" "3.55500" "3.15500" "4500"    "3.35500"
[337] "4500"    "4.2500"  "3.85500" "3.6500"  "3.8500"  "3500"    "4.2500"  "3.55500"
[345] "3.8500"  "4.25500" "3.5500"  "3.85500" "3.8500"  "3.25500" "3.65500" "4.4500" 
[353] "4500"    "3.6500"  "4.4500"  "3.3500"  "4.45500" "4.25500" "4.05500" "3.45500"
[361] "4.3500"  "3.85500" "4.15500" "3.65500" "3.55500" "4.3500"  "3.9500"  "4.4500" 
[369] "4.15500" "4.15500" "3.85500" "4.25500" "3.7500"  "3.8500"  "4.2500"  "3.35500"
[377] "3.2500"  "3.8500"  "4.2500"  "3.95500" "3.85500" "3.25500" "4.35500" "3.1500" 
[385] "3.7500"  "3.35500" "4.1500"  "4.15500" "3.85500" "4.55500" "3.65500" "3.75500"
[393] "3.8500"  "3.25500" "3.2500"  "3.5500"  "3.75500" "3.45500" "4.65500" "4.15500"
[401] "3.25500" "4.1500"  "4.3500"  "4.2500"  "3.4500"  "3.9500"  "4.6500"  "4.05500"
[409] "4.35500" "3.55500" "3.8500"  "3.8500"  "3.55500" "3.8500"  "3.7500"  "4.05500"
[417] "3.65500" "3.55500" "3.5500"  "4.15500" "3.75500" "3.6500"  "3.85500" "3.3500" 
[425] "3.85500" "2.95500" "3.85500" "4.45500" "3.85500" "3.45500" "3.65500" "4.1500" 
[433] "3.6500"  "3.9500"  "3.8500"  "3.15500" "3.65500" "3.4500"  "3.5500"  "4.25500"
[441] "4.2500"  "4500"    "3.6500"  "3.6500"  "3.25500" "4.25500" "3.95500" "3.1500" 
[449] "4.2500"  "3.15500" "3.65500" "4500"    "3.4500"  "4.55500" "4.1500"  "4.5500" 
[457] "3.75500" "3.85500" "4500"    "3.85500" "4.55500" "3.6500"  "4.1500"  "4.3500" 
[465] "4.05500" "3.7500"  "3.95500" "3.55500" "3.1500"  "3.95500" "3.85500" "3.3500" 
[473] "3.95500" "4.25500" "3.95500" "4.1500"  "4.05500" "4.25500" "3.75500" "4.3500" 
[481] "4.3500"  "4.3500"  "4.7500"  "4.45500" "2.9500"  "3.5500"  "3.6500"  "3.55500"
[489] "4.4500"  "4500"    "3.4500"  "3.5500"  "3.45500" "3.35500" "4.65500" "4.3500" 
[497] "3.8500"  "4.3500"  "3.95500" "3.65500"</pre><br>mean(resultado[,1])<br><pre tabindex="0" class="gmail-GGHFMYIBMOB" id="gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:currentcolor;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="gmail-GGHFMYIBCPB gmail-ace_keyword" style="color:blue;white-space:pre">> </span><span class="gmail-GGHFMYIBCOB gmail-ace_keyword" style="color:blue">mean(resultado[,1])
</span>[1] NA
<span class="gmail-GGHFMYIBGOB gmail-ace_constant" style="color:rgb(197,6,11)">Warning message:
</span><span class="gmail-GGHFMYIBGOB gmail-ace_constant" style="color:rgb(197,6,11)">In mean.default(resultado[, 1]) :</span><span class="gmail-GGHFMYIBGOB gmail-ace_constant" style="color:rgb(197,6,11)">
 </span><span class="gmail-GGHFMYIBGOB gmail-ace_constant" style="color:rgb(197,6,11)"> argumento não é numérico nem lógico: retornando NA<br></span><br>Muito obrigado </pre><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><b>"Que força é esta, eu não sei; tudo o que sei é que existe, e está disponível apenas quando alguém está num estado em que sabe exatamente o que quer, e está totalmente determinado a não desistir até conseguir." </b></div>
<div><a href="http://www.pensador.info/frase/NTQwOTE1/" target="_blank"><font size="3" color="#1111cc">Alexander Graham Bell</font></a></div>
<div> </div>
<div>Prof. Clodoaldo José Figueredo Msc - SIAPE 1800348</div>
<div>Métodos Numéricos para Engenharia - Matemática Aplicada</div>
<div>Instituto Federal Catarinense - Campus Araquari<br>Rodovia BR 280 - km 27 - Cx. Postal 21<br>CEP 89245-000 - Araquari/SC<br>Fone: (47) 3803-7240</div>
<div> </div></div></div></div>
<br><div class="gmail_quote">Em 17 de maio de 2017 17:42, Fernando Antonio de souza <span dir="ltr"><<a href="mailto:nandodesouza@gmail.com" target="_blank">nandodesouza@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Clodoaldo</div><div><br></div><div>O código abaixo , ler seus dados e para cada coluna, aplica a função "obs" a saída será uma tabela contendo o número de colunas do seu dado fornecido e cada coluna conterá 500 linhas correspondente as quinhentas amostragens realizadas pela função "sample".</div><div><br></div><div>Assim você pode indentificar cada vetor contendo os 500 dados amostrados através do index de coluna</div><div> por exemplo : resultado[,1]</div><div><br></div><div>Espero ter ajudado</div><div><br></div><div>A disposição</div><div><br></div>dados <- matrix(nrow=10,ncol=16,data=<wbr>rnorm(160))<br><br>obs <- function(x){<span class="gmail-"><br>    <br>        results <- c()<br>        for(i in 1:500){<br>            <br></span>            results[i] <- mean( sample(x,replace=TRUE))<br>            saida <- paste(results,i,sep="")<br>            <br>        }<br>    <br> return(saida)<br>}<br><br>resultado<-apply(dados,2,obs)<br><br><u></u><div>==============================<wbr>===========<br>
Fernando Souza<br>
Zootecnista, DSc. Produção e Alimentação Animal<br>
Celular: (31)99796-8781 (Vivo)<br>
<a href="https://n1.nylas.com/link/982181c7e27b6ef6fdf684e5db1087a882a4023a059b93166c5b32c1a9842d8e/0?redirect=mailto%3Ae-mail%253Anandodesouza%40gmail.com&r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" target="_blank">E-mail:nandodesouza@gmail.com</a><br>
Lattes: <a href="https://n1.nylas.com/link/982181c7e27b6ef6fdf684e5db1087a882a4023a059b93166c5b32c1a9842d8e/1?redirect=http%3A%2F%2Flattes.cnpq.br%2F6519538815038307&r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" target="_blank">http://lattes.cnpq.br/<wbr>6519538815038307</a><br>
Blog: <a href="https://n1.nylas.com/link/982181c7e27b6ef6fdf684e5db1087a882a4023a059b93166c5b32c1a9842d8e/2?redirect=https%3A%2F%2Fproducaoanimalcomr.wordpress.com%2F&r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" target="_blank">https://producaoanimalcomr.<wbr>wordpress.com/</a><br>
==============================<wbr>============<br></div><div><br></div>Sent from <a href="https://n1.nylas.com/link/982181c7e27b6ef6fdf684e5db1087a882a4023a059b93166c5b32c1a9842d8e/3?redirect=https%3A%2F%2Fnylas.com%3Fref%3Dn1&r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" target="_blank">Nylas Mail</a>, the best free email app for work<div><br></div><u></u><img class="gmail-m_-1372578274726926130n1-open" style="border-width: 0px; border-style: none; border-color: currentcolor; border-image: none; width: 0px; height: 0px;" src="https://n1.nylas.com/open/982181c7e27b6ef6fdf684e5db1087a882a4023a059b93166c5b32c1a9842d8e?r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" width="0" height="0">
          <div class="gmail_quote gmail-m_-1372578274726926130nylas-quote gmail-m_-1372578274726926130nylas-quote-id-687b0022ece167e283fab664c838acd85d8ac45e894d5b3acb1081eba3865306"><div><div class="gmail-h5">
            <br>
            On Mai 17 2017, at 4:19 pm, Clodoaldo José Figueredo via R-br <<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>> wrote:
            <br>
            </div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
              <div dir="ltr"><div>Na rotina abaixo eu preciso gravar cada vetor results para os 16 valores de j. Preciso colocar um índice porque esses 16 resultados formarão uma nova matriz com 16 colunas e 500 linhas.<br></div>Como indexar os vetores results no comando "for" e montar a nova matriz?<br><div><div><br>for(j in 1:16){<br>y <- dados[,j]<br>qqnorm(y);qqline(y)<br>mean(y)<br>results <- c()<br>for(i in 1:500){ results[i] <- mean( sample(y,replace=T))}<br>results<br>qqnorm(results);qqline(<wbr>results)<br>mean (results)  <br>}<br><br></div><div>Obrigado<br><br></div><div>Clodoaldo<br><br></div><div><div><div><div dir="ltr"><div><b>"Que força é esta, eu não sei; tudo o que sei é que existe, e está disponível apenas quando alguém está num estado em que sabe exatamente o que quer, e está totalmente determinado a não desistir até conseguir." </b></div>
<div><a href="http://www.pensador.info/frase/NTQwOTE1/&r=Y2xvZG9hbGRvLmZpZ3VlcmVkb0BpZmMtYXJhcXVhcmkuZWR1LmJy" target="_blank">Alexander Graham Bell</a></div>
<div> </div>
<div>Prof. Clodoaldo José Figueredo Msc - SIAPE 1800348</div>
<div>Métodos Numéricos para Engenharia - Matemática Aplicada</div>
<div>Instituto Federal Catarinense - Campus Araquari<br>Rodovia BR 280 - km 27 - Cx. Postal 21<br>CEP 89245-000 - Araquari/SC<br>Fone: (47) 3803-7240</div>
<div> </div></div></div></div>
</div></div></div>
</div></div><pre class="gmail-m_-1372578274726926130nylas-plaintext">______________________________<wbr>_________________
R-br mailing list
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/<wbr>cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-<wbr>guia</a>) e forne�a c�digo m�nimo reproduz�vel.</pre>
            </blockquote>
          </div>
</blockquote></div><br></div></div>