prais
implements the Prais-Winsten estimator for models with strictly exogenous regressors and AR(1) serial correlation of the errors.
install.packages("prais")
# install.packages("devtools") devtools::install_github("franzmohr/prais")
# Load the package library(prais) # Load the data data("barium") pw <- prais_winsten(lchnimp ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6, data = barium, index = "t") summary(pw)
library(lmtest) coeftest(pw, vcov. = vcovHC(pw, "HC1"))
Estimate a panel model, for which PCSE should be obtained.
# Example 2 in the documentation of Stata function xtpcse # Load data data <- haven::read_dta("http://www.stata-press.com/data/r14/grunfeld.dta") # Estimate x <- prais_winsten(invest ~ mvalue + kstock, data = data, index = c("company", "year"), twostep = TRUE, panelwise = TRUE, rhoweight = "T1") # Results summary(x)
Obtain PCSE by using only those residuals from periods that are common to all panels by setting pairwise = FALSE
.
coeftest(x, vcov. = vcovPC(x, pairwise = FALSE))
Obtain PCSE by using all observations that can be matched by period between two panels by setting pairwise = TRUE
.
coeftest(x, vcov. = vcovPC(x, pairwise = TRUE))
Beck, N. L. and Katz, J. N. (1995): What to do (and not to do) with time-series cross-section data. American Political Science Review 89, 634-647.
Prais, S. J. and Winsten, C. B. (1954): Trend Estimators and Serial Correlation. Cowles Commission Discussion Paper, 383 (Chicago).
Wooldridge, J. M. (2016). Introductory Econometrics. A Modern Approach. 6th ed. Mason, OH: South-Western Cengage Learning.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.