Hey R Users! I´m trying to run a waldtest comparing an restricted and unrestricted model.
But sample size is different (because of NA´s), so I get an error message: > caus2<-plm(CSmean~ lag(CSmean,1)+ lag(numfull_FCRlong,1)+ + GDP+linpol_GDPpCapita+fort_budget+fort_percentDebt+ + linpol_primSurplus+Inflation+lagBYmean, + data = data.plm, index = c("countrynr","quartal"),model = "within") > waldtest(caus2,update(caus2,.~.-lag(numfull_FCRlong,1),test = "Chisq") Fehler in waldtest.default(caus2, update(caus2, . ~ . lag(numfull_FCRlong,1), : models were not all fitted to the same size of dataset So I tried to remove the NA´s first: > data.plm.naomit<-na.omit(data.plm) > caus2<-plm(CSmean~ lag(CSmean,1)+ lag(numfull_FCRlong,1)+ + GDP+linpol_GDPpCapita+fort_budget+fort_percentDebt+ + linpol_primSurplus+Inflation+lagBYmean, + data = data.plm.naomit, index = c("countrynr","quartal"),model = "within") Fehler in model.matrix.pFormula(formula, data, rhs = 1, model = model, : NA in the individual index variable Zusätzlich: Warnmeldung: In `[.data.frame`(index, as.numeric(rownames(mf)), ) : NAs durch Umwandlung erzeugt > waldtest(caus2,update(caus2,.~.-lag(numfull_FCRlong,1),test = "Chisq") Fehler in waldtest.default(caus2, update(caus2, . ~ . lag(numfull_FCRlong,1), : models were not all fitted to the same size of dataset But this doesn´t work either, because of the error during the fitting process, another way: > caus2_small<-update(caus2,.~.-lag(numfull_FCRlong,1),data=data.plm[-ch2$na.a ction]) Fehler in -ch2$na.action : ungültiges Argument für unären Operator > waldtest(caus2,ch2_small) What should I do? Is the removal of NA´s a common procedure? Thanks for your advice and have a nice day ;) Katie [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.