<html><head></head><body><div style="color:#000; background-color:#fff; font-family:bookman old style, new york, times, serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1506475707412_6686"><span>Boa noite,</span></div><div id="yui_3_16_0_ym19_1_1506475707412_6802" dir="ltr"><span id="yui_3_16_0_ym19_1_1506475707412_6938">preciso de amostrar em um vetor de nome </span><span id="yui_3_16_0_ym19_1_1506475707412_6858"><span id="yui_3_16_0_ym19_1_1506475707412_6939">populacao</span> amostras de tamanho n, com n variando de tamanhos [2; </span><span id="yui_3_16_0_ym19_1_1506475707412_6877"><span id="yui_3_16_0_ym19_1_1506475707412_6859">tam</span>] e para cada tam repetir </span><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878">nam (vezes) e assim pegar a estimativas de media e dos desvios -padrão das amostras.<br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6903"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878"><br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6904"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878"><br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6912"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878">Para cada amostra obtida extrair desvio padrão, média e guardar em uma matriz com vazia com NAs! Ao final plotar a média dos desvios e a media das medias em função de cada n.</span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6990"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878"><br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6927"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878">Tentei fazer, mas sem sucesso! Caso alguém pude ajudar ficarei grato! <br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6926"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878"><br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6879"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878"><br></span></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_6880"><span id="yui_3_16_0_ym19_1_1506475707412_6810"><span id="yui_3_16_0_ym19_1_1506475707412_6878">#####################################################################################<br></span></span></div><div id="yui_3_16_0_ym19_1_1506475707412_6692" dir="ltr"><span id="yui_3_16_0_ym19_1_1506475707412_6780"><br></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_7076"><span id="yui_3_16_0_ym19_1_1506475707412_6780">n=10<br id="yui_3_16_0_ym19_1_1506475707412_6751">populacao <- rchisq(100000, df = n)<br id="yui_3_16_0_ym19_1_1506475707412_6752">mu=n<br id="yui_3_16_0_ym19_1_1506475707412_6753">s=sqrt(2*n)<br id="yui_3_16_0_ym19_1_1506475707412_6754">mu<br id="yui_3_16_0_ym19_1_1506475707412_6755">s<br id="yui_3_16_0_ym19_1_1506475707412_6756"><br id="yui_3_16_0_ym19_1_1506475707412_6757">par(mfrow = c(1, 3)) <br id="yui_3_16_0_ym19_1_1506475707412_6758">hist(populacao, prob=T, main="Y ~ Quiquadrado(GL=10)",xlab=" ", yla="Densidade",col="limegreen")<br id="yui_3_16_0_ym19_1_1506475707412_6759"></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_7051"><span id="yui_3_16_0_ym19_1_1506475707412_6780"><br id="yui_3_16_0_ym19_1_1506475707412_6760">amostragem<-function(populacao, tam, nam)<br id="yui_3_16_0_ym19_1_1506475707412_6761"> {</span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1506475707412_7022"><span id="yui_3_16_0_ym19_1_1506475707412_6780"> SD<-NULL<br id="yui_3_16_0_ym19_1_1506475707412_6762"> media<-NULL<br id="yui_3_16_0_ym19_1_1506475707412_6763"> X <-matrix(NA, tam, 2)<br id="yui_3_16_0_ym19_1_1506475707412_6764"> {<br id="yui_3_16_0_ym19_1_1506475707412_6765"> for(i in 2:nam)<br id="yui_3_16_0_ym19_1_1506475707412_6766"> amostra<-sample(populacao,tam)<br id="yui_3_16_0_ym19_1_1506475707412_6767"> SD[i]=sd(amostra)<br id="yui_3_16_0_ym19_1_1506475707412_6768"> media[i]<-mean(amostra)<br id="yui_3_16_0_ym19_1_1506475707412_6769"> X[i,] <- c(mean(SD), mean(media))<br id="yui_3_16_0_ym19_1_1506475707412_6770"> }<br id="yui_3_16_0_ym19_1_1506475707412_6771">print(cbind(mean(SD),mean(media))<br id="yui_3_16_0_ym19_1_1506475707412_6772">print(X)<br id="yui_3_16_0_ym19_1_1506475707412_6773">plot.ts(SD, pch=19, type = "p", xlab="Número de folhas amostrada", ylab="Estimativa da Variabiliade", lty=2,xaxp=c(0,150,10))<br id="yui_3_16_0_ym19_1_1506475707412_6774">plot.ts(media, pch=19, type = "p", xlab="Número de folhas amostrada", ylab="Estimativa da média", lty=2,xaxp=c(0,150,10))<br id="yui_3_16_0_ym19_1_1506475707412_6775">}<br id="yui_3_16_0_ym19_1_1506475707412_6776"><br id="yui_3_16_0_ym19_1_1506475707412_6777"><br id="yui_3_16_0_ym19_1_1506475707412_6778">amostragem(populacao, 150, 50000)<br id="yui_3_16_0_ym19_1_1506475707412_6779"></span></div><div id="yui_3_16_0_ym19_1_1506475707412_6605"><div id="yui_3_16_0_ym19_1_1506475707412_7114"> ###########################################################################################</div><div id="yui_3_16_0_ym19_1_1506475707412_7150"><br></div></div><div class="signature" id="yui_3_16_0_ym19_1_1506475707412_6629">obg <br></div></div></body></html>