Estou rodando um modelo usando a função prais_winsten e gostaria de saber como calculo os intervalos de confiança para beta0 e beta1. Já tentei de tudo mas não consegui.
pw <- prais_winsten(formula,data=df)
Se puderem me ajudar, ficarei muito grata.
Att
Oi Camila! Eu rodei um exemplo aqui e vi que a saída traz algumas informações úteis como
estimativa e erro padrão.
No exemplo abaixo tem a saída.
library(prais)
# Generate an artificial sample
set.seed(1234567)
n <- 100
x <- sample(20:40, n, replace = TRUE)
rho <- .5
# AR(1) errors
u <- rnorm(n, 0, 5)
for (i in 2:n) {
u[i] <- u[i] + rho * u[i - 1]
}
pw_sample <- data.frame("x" = x, "y" = 10 + 1.5 * x + u)
# Estimate
pw <- prais_winsten(y ~ x, data = pw_sample)
#> Iteration 0: rho = 0
#> Iteration 1: rho = 0.4145
#> Iteration 2: rho = 0.4201
#> Iteration 3: rho = 0.4202
#> Iteration 4: rho = 0.4202
summary(pw)
#>
#> Call:
#> prais_winsten(formula = y ~ x, data = pw_sample)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -11.7159 -4.1223 0.4258 3.4970 14.3594
#>
#> AR(1) coefficient rho after 4 Iterations: 0.4202
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 8.79680 2.57240 3.42 0.000915 ***
#> x 1.56834 0.08329 18.83 < 2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 5.06 on 98 degrees of freedom
#> Multiple R-squared: 0.7999, Adjusted R-squared: 0.7979
#> F-statistic: 391.8 on 1 and 98 DF, p-value: < 2.2e-16
#>
#> Durbin-Watson statistic (original): 1.143
#> Durbin-Watson statistic (transformed): 2.112
Created on 2020-05-22 by the reprex package (v0.3.0)
Um intervalo de confiança de 95% pros parametros poderia ser:
Beta0: 8.79680 +/- 1.96 * 2.57240
Beta1: 1.56834 +/- 1.96 * 0.08329
Obrigada Athos! Eu calculei assim “na mão” usando o t… mas achei que tivesse uma função específica sabe… mas se não tem, beleza!! mtooo obrigada