[R] error in La.svd Lapack routine 'dgesdd'

Philipp Grueber philipp.grueber at ebs.edu
Thu May 3 01:15:12 CEST 2012


Addendum to my first post:

Since I wish to understand what plm does to my data, I tried to manually
calculate the demeaned values and use OLS. See below how far I got with the
Grunfeld data; formula's are based on Greene's Econometric Analysis. 

Obviously, I am missing at least one important step as my results differ
from both the plm and the LSDV estimations. Transferring the model to my
original dataset, I i) also get different results for the lm vs. the plm
models, however with the "manually" demeaned dataset, I do not end up with
incredibly small standard deviations in the demeaned values. That is, the
step that I am missing when reproducing the plm results is highly probable
to cause the error in my analysis.  

###############

library(plm) 
library(lmtest)
data(Grunfeld) 
head(Grunfeld)
pdata<-pdata.frame(Grunfeld,index=c("firm","year"))
head(pdata)
fm<-inv~value+capital 
mod<-plm(fm, pdata, effect="twoways", model="within") 

y<-Grunfeld$inv
x1<-Grunfeld$value
x2<-Grunfeld$capital

y_i<-c()
x1_i<-c()
x2_i<-c()
for (i in unique(Grunfeld$firm)){
y_i<-c(y_i,rep(mean(Grunfeld$inv[Grunfeld$firm==i],na.rm=TRUE),nrow(Grunfeld)))
x1_i<-c(x1_i,rep(mean(Grunfeld$value[Grunfeld$firm==i],na.rm=TRUE),nrow(Grunfeld)))
x2_i<-c(x2_i,rep(mean(Grunfeld$capital[Grunfeld$firm==i],na.rm=TRUE),nrow(Grunfeld)))
}

y_t<-rep(NA,nrow(Grunfeld))
x1_t<-rep(NA,nrow(Grunfeld))
x2_t<-rep(NA,nrow(Grunfeld))
for (t in unique(Grunfeld$year)){
y_t[Grunfeld$year==t]<-rep(mean(Grunfeld$inv[Grunfeld$year==t],na.rm=TRUE),sum(Grunfeld$year==t))
x1_t[Grunfeld$year==t]<-rep(mean(Grunfeld$value[Grunfeld$year==t],na.rm=TRUE),sum(Grunfeld$year==t))
x2_t[Grunfeld$year==t]<-rep(mean(Grunfeld$capital[Grunfeld$year==t],na.rm=TRUE),sum(Grunfeld$year==t))
}

y_it<-rep(mean(Grunfeld$inv,na.rm=TRUE),nrow(Grunfeld))
x1_it<-rep(mean(Grunfeld$value,na.rm=TRUE),nrow(Grunfeld))
x2_it<-rep(mean(Grunfeld$capital,na.rm=TRUE),nrow(Grunfeld))

y_star<-y-y_i-y_t+y_it
x1_star<-x1-x1_i-x1_t+x1_it
x2_star<-x2-x2_i-x2_t+x2_it

mod_lm<-lm(y_star~x1_star+x2_star-1,na.action=na.omit)

mod_dumm<-lm(Grunfeld$inv~Grunfeld$value+Grunfeld$capital+as.factor(Grunfeld$year)+as.factor(Grunfeld$firm)-1,na.action=na.omit)

coeftest(mod)
coeftest(mod_lm)
coeftest(mod_dumm)

##############

Again, any help is highly appreciated.

Best wishes,
Philipp

-----
____________________________________
EBS Universitaet fuer Wirtschaft und Recht
FARE Department
Wiesbaden/ Germany
http://www.ebs.edu/index.php?id=finacc&L=0
--
View this message in context: http://r.789695.n4.nabble.com/error-in-La-svd-Lapack-routine-dgesdd-tp2125052p4604714.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list