Created
June 25, 2021 14:30
-
-
Save eliardocosta/40d85834ab91808eebf72b1a4435128e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#- EST0116 INFERENCIA II | |
#- Slides 0 | |
# slide 97 ---------------------------------------------------------------- | |
library(MASS) | |
theta <- 3 | |
n <- 20 | |
x <- rgamma(n, shape = theta, rate = 1); x | |
est <- fitdistr(x, "gamma", rate = 1); est | |
emv <- as.numeric(est$estimate[1]); emv # EMV | |
#- IC de 95% para theta | |
emv + c(-1, 1)*qnorm(1 - 0.05/2)*sqrt(1/(n*trigamma(emv))) | |
#- outra forma | |
emv + c(-1, 1)*qnorm(1 - 0.05/2)*est$sd | |
# slide 104 --------------------------------------------------------------- | |
#- CV verdadeiro | |
1/sqrt(theta) | |
#- IC de 95% para o CV | |
1/sqrt(emv) + c(-1, 1)*qnorm(1 - 0.05/2)*sqrt(1/(4*n*trigamma(emv)*emv^3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment