[R] R-code for carrying out step-wise panel regression

Amarjit Singh ajss_alt at yahoo.com
Tue Oct 21 21:35:24 CEST 2014


Dear all
For one of my empirical research investigation,  I tried to carry out step-wise panel regression analysis by making adaptation in the use of plm package (since stepAIC command does not work with plm). Say, I tried to regress an explained variable (DEP) on 3 explanatory variables (EX1, EX2, EX3) using a panel data set (dat). Of course, the required set of instructions would be:require(plm)reg <- plm(DEP ~ EX1 + EX2 + EX3, data = dat, method = "within")             ... (A)But, what I wish to do (for the purpose of carrying out the analysis iteratively) is as follows:dep <- "DEP"exp <- c("EX1", "EX2", "EX3")and then use somehow these dep and exp to get a  statement compatible with (A). I tried the following
frm <- as.formula(paste(dep, "~", exp))reg <- plm(frm, data = dat, method = "within)But it did not work properly. I could get the output only in respect of DEP ~ EX1, whereas I need the same in respect of DEP ~ EX1 + EX2 + EX3.Kindly help.  Or, you may pl. suggest some alternative via media.RegardsAmarjit Singh

	[[alternative HTML version deleted]]



More information about the R-help mailing list