<div dir="ltr"><div>Valeu Gledson, a solução eu sabia. Eu estou procurando mais informações sobre como descobrir o padrão da semente para que isso aconteça, como nos dois últimos exemplos que eu enviei.<br><br></div>Daniel<br>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/1 gledson picharski <span dir="ltr"><<a href="mailto:gledson.picharski@gmail.com" target="_blank">gledson.picharski@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">sorteia sem reposição um conjunto que tenha 25 zeros e 25 uns.<div><br></div><div>## solução 1</div><div>
set.seed(111)<br></div><div>sample(rep(c(0,1),25))<br></div><div><br></div><div>## solução 2</div>
<div>set.seed(111)</div><div>rep(c(0,1),25)[sample(1:50)]<br></div><div><br></div><div><br></div><div>_________________</div><div>Gledson Picharski</div><div><br></div><div><br></div><div>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">Em 1 de maio de 2013 19:48, 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><div class="h5"><div dir="ltr">Caros, estou realizando um experimento e acabei constatando que a semente que eu distribuir é fundamental para eu obter as amostras binárias.<br>
Eu estou interessado em distribuir 25 unidades para tratamento e o restante para controle. Há alguma maneira de saber, sem ser por tentativa e erro, que minha distribuição terá 25 unidades em cada categoria? <br>
Por exemplo,<br><br>> # 50 Bernoulli trials<br>> set.seed(51)<br>> T <- sample(c(0,1), 50, replace=TRUE, prob=c(25/50, 25/50))<br>> table(T) <br>T<br> 0 1 <br>22 28 <br><br>> set.seed(12345)<br>> T <- sample(c(0,1), 50, replace=TRUE, prob=c(25/50, 25/50))<br>
> table(T)<br>T<br> 0 1 <br>23 27 <br><div><br>> set.seed(123)<br>> T <- sample(c(0,1), 50, replace=TRUE, prob=c(25/50, 25/50))<br>> table(T)<br>T<br> 0 1 <br>25 25 <br><br>> set.seed(2)<br>> T <- sample(c(0,1), 50, replace=TRUE, prob=c(25/50, 25/50))<br>
> table(T)<br>T<br> 0 1 <br>25 25<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div><br></div><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>
</div></font></span></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.<br></blockquote></div><br></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><br clear="all"><br>-- <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">☎ (514) 343 6111 #3799</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>
</div>