confint.RdIt produces confidence intervals for the coefficients from gel or gmm estimation.
# S3 method for class 'gel'
confint(object, parm, level = 0.95, lambda = FALSE,
type = c("Wald", "invLR", "invLM", "invJ"),
fact = 3, corr = NULL, ...)
# S3 method for class 'gmm'
confint(object, parm, level = 0.95, ...)
# S3 method for class 'ategel'
confint(object, parm, level = 0.95, lambda = FALSE,
type = c("Wald", "invLR", "invLM", "invJ"), fact = 3,
corr = NULL, robToMiss=TRUE, ...)
# S3 method for class 'confint'
print(x, digits = 5, ...)An object of class gel or gmm returned by the function gel or gmm
A specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.
The confidence level
If set to TRUE, the confidence intervals for the Lagrange multipliers are produced.
'Wald' is the usual symetric confidence interval. The thee others are based on the inversion of the LR, LM, and J tests.
This parameter control the span of search for the inversion of the test. By default we search within plus or minus 3 times the standard error of the coefficient estimate.
This numeric scalar is meant to apply a correction to the critical value, such as a Bartlett correction. This value depends on the model (See Owen; 2001)
An object of class confint produced by confint.gel and confint.gmm
The number of digits to be printed
If TRUE, the confidence interval is based on the
standard errors that are robust to misspecification
Other arguments when confint is applied to another classe object
It returns a matrix with the first column being the lower bound and the second the upper bound.
Hansen, L.P. (1982), Large Sample Properties of Generalized Method of Moments Estimators. Econometrica, 50, 1029-1054, Hansen, L.P. and Heaton, J. and Yaron, A.(1996), Finit-Sample Properties of Some Alternative GMM Estimators. Journal of Business and Economic Statistics, 14 262-280. Owen, A.B. (2001), Empirical Likelihood. Monographs on Statistics and Applied Probability 92, Chapman and Hall/CRC
#################
n = 500
phi<-c(.2,.7)
thet <- 0
sd <- .2
x <- matrix(arima.sim(n = n, list(order = c(2,0,1), ar = phi, ma = thet, sd = sd)), ncol = 1)
y <- x[7:n]
ym1 <- x[6:(n-1)]
ym2 <- x[5:(n-2)]
H <- cbind(x[4:(n-3)], x[3:(n-4)], x[2:(n-5)], x[1:(n-6)])
g <- y ~ ym1 + ym2
x <- H
t0 <- c(0,.5,.5)
resGel <- gel(g, x, t0)
confint(resGel)
#>
#> Direct Wald type confidence interval
#> #######################################
#> 0.025 0.975
#> (Intercept) -0.048635 0.136493
#> ym1 0.065245 0.284611
#> ym2 0.604171 0.824085
confint(resGel, level = 0.90)
#>
#> Direct Wald type confidence interval
#> #######################################
#> 0.05 0.95
#> (Intercept) -0.033753 0.121612
#> ym1 0.082879 0.266976
#> ym2 0.621849 0.806407
confint(resGel, lambda = TRUE)
#>
#> Direct Wald type confidence interval
#> #######################################
#> 0.025 0.975
#> Lam((Intercept)) -0.0124721 0.0054356
#> Lam(h1) -0.0771139 0.0503036
#> Lam(h2) -0.0880200 0.0422872
#> Lam(h3) -0.0779825 0.1066611
#> Lam(h4) -0.0619208 0.1159484
########################
resGmm <- gmm(g, x)
confint(resGmm)
#>
#> Wald type confidence interval
#> #######################################
#> 0.025 0.975
#> (Intercept) -0.066702 0.149889
#> ym1 0.069098 0.286556
#> ym2 0.605125 0.825783
confint(resGmm, level = 0.90)
#>
#> Wald type confidence interval
#> #######################################
#> 0.05 0.95
#> (Intercept) -0.049291 0.132478
#> ym1 0.086579 0.269075
#> ym2 0.622863 0.808045
## Confidence interval with inversion of the LR, LM or J test.
##############################################################
set.seed(112233)
x <- rt(40, 3)
y <- x+rt(40,3)
# Simple interval on the mean
res <- gel(x~1, ~1, method="Brent", lower=-4, upper=4)
#> Error in eval(predvars, data, env): object 'x' not found
confint(res, type = "invLR")
#> Error: object 'res' not found
confint(res)
#> Error: object 'res' not found
# Using a Bartlett correction
k <- mean((x-mean(x))^4)/sd(x)^4
s <- mean((x-mean(x))^3)/sd(x)^3
a <- k/2-s^2/3
corr <- 1+a/40
confint(res, type = "invLR", corr=corr)
#> Error: object 'res' not found
# Interval on the slope
res <- gel(y~x, ~x)
#> Error in eval(predvars, data, env): object 'x' not found
confint(res, "x", type="invLR")
#> Error: object 'res' not found
confint(res, "x")
#> Error: object 'res' not found