Não foi possível enviar o arquivo. Será algum problema com as permissões?
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
Ambos lados da revisão anterior Revisão anterior | Próxima revisão Ambos lados da revisão seguinte | ||
disciplinas:ce223:comandos2008 [2008/03/19 15:14] ehlers |
disciplinas:ce223:comandos2008 [2008/03/26 17:42] paulojus |
||
---|---|---|---|
Linha 542: | Linha 542: | ||
</code> | </code> | ||
+ | ==== Semana 5 ==== | ||
+ | |||
+ | === 24/03/2008 === | ||
+ | |||
+ | <code R> | ||
+ | N<- rpois(10000, lambda=15) | ||
+ | Pr<- rexp(10000, rate=1/50000) | ||
+ | Y<- N*Pr | ||
+ | q99 <- quantile(Y, prob=0.99) | ||
+ | hist(Y) | ||
+ | |||
+ | |||
+ | hist(Y, prob=T) | ||
+ | lines(density(Y)) | ||
+ | plot(density(Y)) | ||
+ | abline(v=q99) | ||
+ | |||
+ | |||
+ | hy<- hist(Y) | ||
+ | hy | ||
+ | class(hy) | ||
+ | plot(hy) | ||
+ | hist | ||
+ | </code> | ||
+ | |||
+ | Criando função: | ||
+ | |||
+ | <code R> | ||
+ | mf<- function(n,lam,r,q){ | ||
+ | N<-rpois(n,lambda=lam) | ||
+ | Pr<-rexp(n,rate=r) | ||
+ | Y<-N*Pr | ||
+ | qq <- quantile(Y,prob=q) | ||
+ | hist(Y,prob=T) | ||
+ | lines(density(Y)) | ||
+ | abline(v=qq) | ||
+ | text("topright", paste("quantil", q, "=", qq)) | ||
+ | return(invisible(qq)) | ||
+ | } | ||
+ | |||
+ | mf(10000, 15, 1/50000, 0.99) | ||
+ | resp<- mf(10000,15, 1/50000, 0.99) | ||
+ | resp | ||
+ | </code> |