<html><head></head><body><div class="ydpb6c6f054yahoo-style-wrap" style="font-family: bookman old style, new york, times, serif; font-size: 16px;"><div style=""><div dir="ltr" data-setdir="false" style="font-size: 16px;">Boa tarde prezados, uma vez mais, solicitando a ajuda dos amigos!!</div><div dir="ltr" data-setdir="false" style="font-size: 16px;"><br></div><div dir="ltr" data-setdir="false" style="font-size: 16px;">Estou necessitando gerar valores de uma normal, condicionada a parâmetros de interesse, como no exemplo reproduzível abaixo:</div><div dir="ltr" data-setdir="false" style="font-size: 16px;"><br></div><div dir="ltr" data-setdir="false" style=""><div style=""><div style=""><font color="#cd232c" style="" size="2">x<-c("X1","X2","X3","X4")</font></div><div style=""><font color="#cd232c" size="2">média<-c(100,120,150,180)</font></div><div style=""><font color="#cd232c" size="2">dp<-c(20,15,10,25)</font></div><div style="" dir="ltr" data-setdir="false"><font color="#cd232c" size="2"><span><span style="color: rgb(205, 35, 44); font-family: bookman old style, new york, times, serif; font-size: small;">exemplo<-data.frame(cbind(x,média,dp))</span></span><br></font></div><div style=""><font color="#cd232c" size="2"><br></font></div><div style="">O meu objetivo é gerar de forma automática, <b>para cada linha</b>, uma distribuição normal com os parâmetros nessas linhas. No exemplo, para a linha que contêm X1, gerar 1000 valores de uma normal com média=100 e dp=20, para a linha que contêm X2, gerar 1000 valores de uma normal de média=120 e dp=15, e assim sucessivamente, até o último vetor, gerado pelos parâmetros da última linha (média=180 e dp=25).  Algo similar a isso:</div><div style=""><br></div></div></div><div dir="ltr" data-setdir="false" style=""><span style="color: rgb(205, 35, 44); font-size: small;">for (i in 1:nrow(exemplo)){</span><br></div><div dir="ltr" data-setdir="false" style=""><div><div style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><font color="#cd232c" size="2">  </font></div><div style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><font color="#cd232c" size="2">  simu[i]<-rnorm(100,exemplo[i,2],exemplo[i,3])</font></div><div style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><font color="#cd232c" size="2">  </font></div><div style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><font color="#cd232c" size="2">}</font></div></div><br></div><div dir="ltr" data-setdir="false" style="">Alguém teria uma solução para isso? É que o número de linhas dessa tabela "exemplo" poderá variar.</div><div dir="ltr" data-setdir="false" style=""><br></div><div dir="ltr" data-setdir="false" style="">Muito obrigado!!!</div><div dir="ltr" data-setdir="false" style=""><i style="font-family: Helvetica, Arial, sans-serif;"><span style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;"><br></font></span></i></div><div dir="ltr" data-setdir="false" style=""><i id="ydpcf278505yui_3_16_0_1_1497025264182_38508" style="font-family: Helvetica, Arial, sans-serif;"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38507" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Diogo Jerônimo</font></span></i></div><div dir="ltr" data-setdir="false" style=""><i id="ydpcf278505yui_3_16_0_1_1497025264182_38430" style="font-family: Helvetica, Arial, sans-serif;"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38429" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Bacharel em Ciências Estatísticas - ENCE/IBGE</font></span></i></div><div dir="ltr" data-setdir="false" style=""><i id="ydpcf278505yui_3_16_0_1_1497025264182_38309" style="font-family: Helvetica, Arial, sans-serif;"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38308" style="color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" style="background-color: inherit;">Mestre em Metrologia - PUC-Rio/PósMQI</font></span></i></div><div dir="ltr" data-setdir="false" style=""><i id="ydpcf278505yui_3_16_0_1_1497025264182_38323" style="font-family: Helvetica, Arial, sans-serif;"><span id="ydpcf278505yui_3_16_0_1_1497025264182_38322" style="line-height:17.12px;color:rgb(0, 0, 191);font-size:medium;"><font face="Courier New, courier, monaco, monospace, sans-serif" id="ydpcf278505yui_3_16_0_1_1497025264182_38695" style="background-color: inherit;">http://lattes.cnpq.br/8996149312896520</font></span></i></div></div></div></body></html>