[R] plm function & plm r.squared error

Nina Schönfelder nina.schoenfelder at fernuni-hagen.de
Tue Feb 17 13:18:49 CET 2015


Dear Constanze,

the error message gives you a hint, where the problem might be. The 
first error massage says that you have NAs in your index variables 
"Unit" and "Week". You can check that with the is.na() function. The 
second error message (r.squared) tells you to specify the model, that is 
on which transformation of the data the R-squared has to be computed.  
There is no default. Moreover, you insert a dataframe ("pCN04") instead 
on a plm object in r.squared().

Kind regards

Nina Schönfelder

-----
FernUniversität in Hagen
Fakultät für Wirtschaftswissenschaft
Lehrstuhl für Volkswirtschaftslehre,
insbes. Makroökonomik
58084 Hagen


On 16/02/15 22:25, fay constanze wrote:
> DearGiovanni,Congratulationsfor the?truly helpful?plm package! Being new to R, I have a problem with the plm function for financial markets timeseries data: After having defined a large, unbalanced panel pdata.frame (https://www.dropbox.com/s/2r9t1cu9v65gobk/Database_CN_2004.csv?dl=0)and running a simple OLS model of two variables regressing company returns(Perf) on index returns (PerfIn)synch <-plm (Perf ~ PerfIn , data=pCN04, na.action = na.omit, index=c("Unit", "Week"), model="pooling") I keepreceiving the following error:Error in model.matrix.pFormula(formula, data, rhs =1, model = model,? : ? NA in theindividual index variableIn addition:Warning message:In `[.data.frame`(index, as.numeric(rownames(mf)),) :? NAsintroduced by coercion
> There aremuch more NAs in y (Perf) than in x (PerfIn) and I have tried to get rid ofthem with na.omit. Another error I have is with the same model for the r.squaredfunction r.squared(pCN04,model=NULL, Perf ~ PerfIn, type= "ess")Error in tss.default(object, model = model) : ??unused argument (model = model)In addition: Warning message:In mean.default(haty) : argument is not numeric or logical: returning NAMany thanks in advance,your help is very precious to me!Constanze
>
>



More information about the R-help mailing list