Johann Maier
2011-May-06 13:19 UTC
[R] pcse package error message concerning nrows of using data
Dear R Community, I am currently facing this seemingly obscure Problem with Panel Corrected Standard Errors (PCSE) following Beck & Katz (1995). As the authors suggest, I regressed a linear model (tmodel) with lm() with option "na.action=na.exclude" (I have also tried other options here). My dataframe is organized in pooled times series fashion, but with various missing values along the spacial and temporal dimension. library(pcse) tmodel<-lm(var1 ~ var2 + var3 + var4 + as.factor(year) , data=dataframe.2, na.action="na.exclude") pcse.tmodel<-pcse(tmodel, groupN = country, groupT = year, pairwise=TRUE) Error in pcse(tmodel, groupN = country, groupT = year, pairwise = TRUE) : Length of groupN and groupT must equal nrows of using data. I have checked the length of groupN, groupT and the residuals of tmodel, only to find out they are equally long (N=1667.) To my knowledge, the pairwise=TRUE argument should have accounted for the Problem of missing values, i.e. an unbalanced panel. But pairwise=FALSE produces the same error message. Would repeating the regression only with cases without missing values solve the problem? I hope I have given sufficient information for you to be able to identify the problem. Thanks in advance, Johann Maier [[alternative HTML version deleted]]
Seemingly Similar Threads
- pcse package - clarifying question about arguments groupN and groupT
- using "unstack" inside my function: that old scope problem again
- pcse package - is it OK to use it when my regression is weighted by each subgroup's mean
- Panel data - replicating Stata's xtpcse in R
- R interpretation