Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205343

Residual stationarity test panel data using R

$
0
0

I am running a panel regression in R. I would like to test for stationarity.

By doing a test on my dependent and independent variables, I couldn't reject H0 of unit root for one of my independent variables. For the other independent variables I got error. My dependent variable is stationary.

Now, I would like to test if the total of my independent variables is stationary by testing for unit root in the residuals of my model. I think the problem I got is that I can't store my residuals in my panel data framework.

I've tried this in R:

add_residuals(pdata,pmodel3,var="resid")

Result:

Error in UseMethod("predict") : 
      no applicable method for 'predict' applied to an object of class 
    "c('plm', 'panelmodel')"

I think that I can do this test if my residuals are added in the panel data framework:

DataNew <- subset(pdata, !YEAR %in% YEAR[is.na(resid)])
y<-data.frame(split(DataNew(resid),DataNew$COUN))
purtest(y, test="madwu", exo="intercept", lags="AIC",pmax=4)

An other question is: How I can plot my residuals over the years for every country individually to check stationarity graphically?


Viewing all articles
Browse latest Browse all 205343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>