Description Usage Arguments Details Value Author(s) See Also Examples
For a given set of endogenous variables in an instrumental variables model coeftestIV provides you the coefficients matrix with estimates, std errs, t-ratios and p-values for both homoscedastic and heteroscedastic errors. Also, clustered standard error can be calculated.
1 | coeftestIV(ivregfit, lmfit, vars, cls = NULL, vcov)
|
ivregfit |
An object of class 'ivregEX', an output of ivreg.EX or ivreg.fit.Ex function. |
lmfit |
An object of class 'lm', an output of lmfit or lm function. |
vars |
A vector of endogenous variables of the instrumental variables model for which the standard error calculation and significance test to be performed. |
cls |
A numeric vector specifying the stratification strata structure of the model. Default setting of NULL assumes no stratification. |
vcov |
A specification of the covariance matrix of the estimated coefficients. This can be specified as a matrix or as a function yielding a matrix when applied to x. Only used for the computation under heteroscedastic errors. Default is vcovHC. |
For details on vcov
see the documentation of coeftest
in "lmtest"
package.
An object of class 'coeftest'
. A matrix of coefficient estimates, standard errors,
t-ratios and p-values.
Bikram Karmakar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data("CigarettesSW", package = "AER")
CigarettesSW$rprice <- with(CigarettesSW, price/cpi)
CigarettesSW$rincome <- with(CigarettesSW, income/population/cpi)
CigarettesSW$tdiff <- with(CigarettesSW, (taxs - tax)/cpi)
fm2 <- ivreg.EX(log(packs) ~ log(rprice) + log(rincome) | tdiff + log(rincome),
data = CigarettesSW, subset = year == "1995")
lmfit <- lm(log(packs) ~ log(rprice) + log(rincome), data = CigarettesSW,
subset = year == "1995")
res = coeftestIV(fm2, lmfit, 'log(rprice)')
##############
x = CigarettesSW[CigarettesSW[,'year'] == "1995", c('rprice', 'rincome')]
y = CigarettesSW[CigarettesSW[,'year'] == "1995", c('packs')]
z = CigarettesSW[CigarettesSW[,'year'] == "1995", c('tdiff', 'rincome')]
fm3 <- ivreg.fit.EX(as.matrix(x), y, z)
lmfit <- lm(packs ~ rprice + rincome, data = CigarettesSW, subset = year == "1995")
res = coeftestIV(fm3, lmfit, 'rprice')
res
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.