Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Load libraries
- library(nlme) # Estimation of mixed effects models
- library(lme4) # Alternative package for mixed effects models
- library(plm) # Econometrics package for linear panel models
- library(arm) # Gelman & Hill code for mixed effects simulation
- library(pcse) # Calculate PCSEs for LS models (Beck & Katz)
- library(tseries) # For ADF unit root test
- library(simcf) # For panel functions and simulators
- # Estimate a random effects AR(I)MA(p,q) model using lme (Restricted ML)
- lme.res1 <- lme(# A formula object including the response,
- # the fixed covariates, and any grouping variables
- fixed = GDPWdiff ~ OIL + REG + EDT,
- # The random effects component
- random = ~ 1 | COUNTRY,
- # The TS dynamics: specify the time & group variables,
- # and the order of the ARMA(p,q) process
- correlation = corARMA(form = ~ YEAR | COUNTRY,
- p = 1, # AR(p) order
- q = 0 # MA(q) order
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement