<div dir="ltr">Obrigado Daniel, <br><br>com o auxilio do seu exemplo anterior, eu usei os seguintes comandos<div><div># Alocação</div><div>sub1 <- pop[(1:10)]</div><div>sub2 <- pop[(11:50)]</div><div><br></div><div># Alocação proporcional </div>
<div>aux1 <- sample(sub2, 8 )</div><div>aux2 <- sample(sub1, 2)</div><div><br></div><div> set.seed(51)</div><div>sub3 <- c(aux1,aux2)<br><br>vou compara-los. abraço</div></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">Em 29 de abril de 2013 17:19, Daniel Marcelino <span dir="ltr"><<a href="mailto:dmarcelino@live.com" target="_blank">dmarcelino@live.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Matheus, você quer fazer especificamente obter uma amostra levando em conta a alocação proporcional não apenas do segundo grupo, mas em ralação aos 50 municípios, é isso velho? Se for, o exemplo que eu te passei não satisfaz, pois alí a alocação proporcional leva em conta a população apenas dos 40 municípios restantes.<div>


<br></div><div>Uma saída seria gerar o sample a partir dos 50 e então verificar se o município pertence ao primeiro ou ao segundo grupo.</div><div><br></div><div>prop <- pop/sum(pop)</div><div><div>sub1 <- pop[(1:10)]</div>


<div>sub2 <- pop[(11:50)]</div><div><span style="font-family:arial,sans-serif;font-size:13px"> set.seed(51)</span><br></div><div>sub3 <- sample(pop, 10, replace=TRUE, prob=prop)<br></div><div><br></div><div># identifica</div>


<div>match(sub1,sub3)<br></div><div>match(sub2,sub3)<br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/29 Matheus Monteiro <span dir="ltr"><<a href="mailto:matheusmont@gmail.com" target="_blank">matheusmont@gmail.com</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Alguém?</div><div class="gmail_extra"><br><br><div class="gmail_quote">Em 29 de abril de 2013 01:26, Matheus Monteiro <span dir="ltr"><<a href="mailto:matheusmont@gmail.com" target="_blank">matheusmont@gmail.com</a>></span> escreveu:<div>


<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Apenas uma dúvida, em sub3 nao seria:<br><br><span style="font-family:arial,sans-serif;font-size:13px">sub3</span><span style="font-family:arial,sans-serif;font-size:13px"> <- sample(sub1+sub2, 10, replace=TRUE, prob=prop)<br>




</span><br>pois preciso trabalhar com os dados contidos nos dois estratos<br><br>desculpe se estiver falando besteira</div><div class="gmail_extra"><br><br><div class="gmail_quote">Em 29 de abril de 2013 01:21, Matheus Monteiro <span dir="ltr"><<a href="mailto:matheusmont@gmail.com" target="_blank">matheusmont@gmail.com</a>></span> escreveu:<div>



<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Obrigado amigo.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">Em 29 de abril de 2013 01:14, Daniel Marcelino <span dir="ltr"><<a href="mailto:dmarcelino@live.com" target="_blank">dmarcelino@live.com</a>></span> escreveu:<div>




<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Isso tá com cara de dever de casa.<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">pop = c(11376685,6390290,2710968,</span><span style="font-family:arial,sans-serif;font-size:13px">2648532,2500532,2395785,</span><span style="font-family:arial,sans-serif;font-size:13px">1861838,1776761,1555039,</span><span style="font-family:arial,sans-serif;font-size:13px">1416014,1410430,1333767,</span><span style="font-family:arial,sans-serif;font-size:13px">1244518,1098630,1039610,</span><span style="font-family:arial,sans-serif;font-size:13px">1016128,953393,867067,830231,</span><span style="font-family:arial,sans-serif;font-size:13px">817590,805397,801746,774886,</span><span style="font-family:arial,sans-serif;font-size:13px">742428,680496,668877,654786,</span><span style="font-family:arial,sans-serif;font-size:13px">643603,619746,619536,613815,</span><span style="font-family:arial,sans-serif;font-size:13px">600692,587701,568099,561329,</span><span style="font-family:arial,sans-serif;font-size:13px">526338,525225,515707,491807,</span><span style="font-family:arial,sans-serif;font-size:13px">483821,474596,474596,472300,</span><span style="font-family:arial,sans-serif;font-size:13px">460062,446911,442701,433158,</span><span style="font-family:arial,sans-serif;font-size:13px">425169,424948,422569)</span></div>









<div><br></div><div># order</div><div>pop <- sort(pop, T)<br></div><div><br></div><div># Alocação</div><div>sub1 <- pop[(1:10)]<br></div><div>sub2 <- pop[(11:50)]<br></div><div><br></div>

<div># Alocação proporcional </div><div>prop <- sub2/sum(sub2) </div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"> set.seed(51)</span><br></div><div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">sub3</span><span style="font-family:arial,sans-serif;font-size:13px"> <- sample(sub2, 10, replace=TRUE, prob=prop)</span></div>







<div class="gmail_extra"><br style="font-family:arial,sans-serif;font-size:13px"># Stats<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">  m <- c(mean(sub1),mean(sub3))</span><br style="font-family:arial,sans-serif;font-size:13px">







<span style="font-family:arial,sans-serif;font-size:13px">  var <- c(var(</span><span style="font-family:arial,sans-serif;font-size:13px">sub1</span><span style="font-family:arial,sans-serif;font-size:13px">),var(</span><span style="font-family:arial,sans-serif;font-size:13px">sub3</span><span style="font-family:arial,sans-serif;font-size:13px">))</span><br style="font-family:arial,sans-serif;font-size:13px">







<span style="font-family:arial,sans-serif;font-size:13px"> stddev <- sqrt(var)</span><br style="font-family:arial,sans-serif;font-size:13px"><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">  tab <- data.frame(m,</span><span style="font-family:arial,sans-serif;font-size:13px"> var</span><span style="font-family:arial,sans-serif;font-size:13px">,</span><span style="font-family:arial,sans-serif;font-size:13px"> stddev</span><span style="font-family:arial,sans-serif;font-size:13px">)</span><br style="font-family:arial,sans-serif;font-size:13px">







<span style="font-family:arial,sans-serif;font-size:13px">  rownames(tab) <- c("+Pop","-Pop")</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">  tab</span><br style="font-family:arial,sans-serif;font-size:13px">







</div>
<div class="gmail_extra"><font face="arial, sans-serif"><br></font>Daniel</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">2013/4/28 Matheus Monteiro <span dir="ltr"><<a href="mailto:matheusmont@gmail.com" target="_blank">matheusmont@gmail.com</a>></span><br>









<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><font face="arial, sans-serif">Ainda trabalhando com os 50 municipios mais populosos do Brasil, divido a população em dois estratos, onde no primeiro estrato esteja os 10 mais populosos e no segundo os 40 restantes.</font><br style="font-family:arial,sans-serif;font-size:12.727272033691406px">










<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">Preciso obter uma amostra com reposição de 10 municípios usando o alocação proporcional e calcular a estimativa da média e variancia.</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px">










<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">Alguém pode ajudar?</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px"><div style="font-family:arial,sans-serif;font-size:12.727272033691406px">










<br></div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px">pop = c(11376685,6390290,2710968,2648532,2500532,2395785,1861838,1776761,1555039,1416014,1410430,1333767,1244518,1098630,1039610,1016128,953393,867067,830231,817590,805397,801746,774886,742428,680496,668877,654786,643603,619746,619536,613815,600692,587701,568099,561329,526338,525225,515707,491807,483821,474596,474596,472300,460062,446911,442701,433158,425169,424948,422569)</div>










<div style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px">








<br></div></div>
<br></div></div>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<span><font color="#888888"><br></font></span></blockquote>
</div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>



<div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:10pt">\begin{signature}</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">Daniel Marcelino</span><br style="font-family:arial;font-size:small">









<span style="font-family:arial;font-size:10pt">☁ </span><a href="mailto:dm.silva@umontreal.ca" style="font-family:arial;font-size:small" target="_blank">dm.silva@umontreal.ca</a><span style="font-family:arial;font-size:10pt"> </span><br style="font-family:arial;font-size:small">









<span style="font-family:arial;font-size:10pt">☎ <a href="tel:%28514%29%20343%206111%20%233799" value="+15143436111" target="_blank">(514) 343 6111 #3799</a></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px">








<font face="Verdana"><span style="font-family:arial;font-size:13px">Skype: d.marcelino </span></font></div>
<div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:10pt">✎ 3200 Jean Brillant,  Office C5071</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">Montreal, QC; H3T 1N8</span><br style="font-family:arial;font-size:small">









<span style="font-family:arial;font-size:10pt">Canada</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">\end{signature}</span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px">









<font face="Verdana"><span style="font-family:arial;font-size:13px"><br></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:13px">"Small steps toward a much better world"</span></font></div>










</font></span></div></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div></div></div><br></div>
</blockquote></div></div></div><br></div>
</blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote>
</div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>

<div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:10pt">\begin{signature}</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">Daniel Marcelino</span><br style="font-family:arial;font-size:small">


<span style="font-family:arial;font-size:10pt">☁ </span><a href="mailto:dm.silva@umontreal.ca" style="font-family:arial;font-size:small" target="_blank">dm.silva@umontreal.ca</a><span style="font-family:arial;font-size:10pt"> </span><br style="font-family:arial;font-size:small">


<span style="font-family:arial;font-size:10pt">☎ <a href="tel:%28514%29%20343%206111%20%233799" value="+15143436111" target="_blank">(514) 343 6111 #3799</a></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px">
<font face="Verdana"><span style="font-family:arial;font-size:13px">Skype: d.marcelino </span></font></div>

<div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:10pt">✎ 3200 Jean Brillant,  Office C5071</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">Montreal, QC; H3T 1N8</span><br style="font-family:arial;font-size:small">


<span style="font-family:arial;font-size:10pt">Canada</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:10pt">\end{signature}</span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px">


<font face="Verdana"><span style="font-family:arial;font-size:13px"><br></span></font></div><div style="font-family:Calibri,sans-serif;font-size:16px"><font face="Verdana"><span style="font-family:arial;font-size:13px">"Small steps toward a much better world"</span></font></div>



</font></span></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>