<font face="trebuchet ms,sans-serif">Inicialmente posso sugerir 2 abordagens<br><br><span style="font-family:courier new,monospace"># simulando da gamma e truncando entre 3 e 10<br>curve(dgamma(x, shape=3, scale=2), 0, 20)<br>
x <- rgamma(100, shape=3, scale=2)<br><br># opção 1, truncar após simular<br>x <- x[x>=3 & x<=10]<br>length(x) # terá que simular mais que 100 para ter n útil > 100<br><br># opção 2, simular após truncar (transformação integral da probabilidade)<br>
curve(pgamma(x, shape=3, scale=2), 0, 20)<br>xtrun <- c(3,10)<br>ytrun <- pgamma(xtrun, shape=3, scale=2)<br>abline(v=xtrun, h=ytrun)<br><br>u <- runif(100, ytrun[1], ytrun[2])<br>x <- qgamma(u, shape=3, scale=2)<br>
<br>curve(pgamma(x, shape=3, scale=2), 0, 20)<br>rug(x)<br>rug(u, side=2)<br><br>curve(dgamma(x, shape=3, scale=2), 0, 20)<br>rug(x)<br>abline(v=xtrun, col=2)<br></span><br>À disposição.<br>Walmes.<br><br clear="all"></font><span style="font-family:trebuchet ms,sans-serif">==========================================================================</span><br style="font-family:trebuchet ms,sans-serif">
<span style="font-family:trebuchet ms,sans-serif">Walmes Marques Zeviani</span><br style="font-family:trebuchet ms,sans-serif"><span style="font-family:trebuchet ms,sans-serif">LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)</span><br style="font-family:trebuchet ms,sans-serif">
<span style="font-family:trebuchet ms,sans-serif">Departamento de Estatística - Universidade Federal do Paraná</span><br style="font-family:trebuchet ms,sans-serif"><span style="font-family:trebuchet ms,sans-serif">fone: (+55) 41 3361 3573</span><br style="font-family:trebuchet ms,sans-serif">
<span style="font-family:trebuchet ms,sans-serif">VoIP: (3361 3600) 1053 1173</span><br style="font-family:trebuchet ms,sans-serif"><span style="font-family:trebuchet ms,sans-serif">e-mail: <a href="mailto:walmes@ufpr.br" target="_blank">walmes@ufpr.br</a><br>
skype: walmeszeviani<br style="font-family:trebuchet ms,sans-serif"></span><span style="font-family:trebuchet ms,sans-serif">twitter: @walmeszeviani</span><br style="font-family:trebuchet ms,sans-serif"><span style="font-family:trebuchet ms,sans-serif">homepage: <a href="http://www.leg.ufpr.br/%7Ewalmes" target="_blank">http://www.leg.ufpr.br/~walmes</a></span><br style="font-family:trebuchet ms,sans-serif">
<span style="font-family:trebuchet ms,sans-serif">linux user number: 531218</span><br style="font-family:trebuchet ms,sans-serif"><span style="font-family:trebuchet ms,sans-serif">==========================================================================</span><br>