[R] Problem in plm package

tomas.krehlik tomas.krehlik at gmail.com
Tue Jul 10 00:26:12 CEST 2012


Hello everyone,

I am working with plm package and I have problem with random and within
models, which are giving errors which says "empty model". However, the model
is not empty. In the source code for plm.fit, where the error originates it
says something like (writing from the top of my head...)

X <- model.matrix(formula,data, lhs=1,...)
if (ncol(X) == 0) stop("empty model")

however if I try to replicate this behaviour with the commands I am inputing
into the original function, it gives ncol(X) is 17 or something like that.

My code is (I am not sure about sharing permissions for dataset... ):
library(sampleSelection)
library(foreign)
library(censReg)
library(plm)
library(micEcon)
library(ggplot2)

data <- read.dta('kpfull1.dta')
summary(data)
attach(data)
# profit share ratio. as profit I take profit in 91 which is the closest
year and as share I take number of shares offered for voucher scheme
data$profit_share <- p91/tnsvp
data$debt_assets <- d91/naba
data$naba3 <- naba^3
data$difprofit <- p91-p90
data$agri <- (mind==1)*1
data$hi <- (mind==2)*1
data$li <- (mind==3)*1
data$constr <- (mind==4)*1
data$trans <- (mind==5)*1
data$trade <- (mind==6)*1
data$rd <- (mind==7)*1
data$ser <- (mind==8)*1
data$fin <- (mind==9)*1
data$for1 <- data[,7]
detach(data)
data1 <- data
panel <- pdata.frame(data, c("num","rnd"))

testovaci <- plm(tb ~ profit_share  + debt_assets + naba + naba3 + for1 +
dom + difprofit + agri + hi + li + constr + trans + trade + rd + ser + fin,
data = panel, model = "within")
summary(testovaci)

model.matrix(tb ~ profit_share  + debt_assets + naba + naba3 + for1 + dom +
difprofit + agri + hi + li + constr + trans + trade + rd + ser + fin, data)

model.matrix(tb ~ profit_share  + debt_assets + naba + naba3 + for1 + dom +
difprofit + agri + hi + li + constr + trans + trade + rd + ser + fin, panel)

Thanks,
Tomáš Křehlík.

--
View this message in context: http://r.789695.n4.nabble.com/Problem-in-plm-package-tp4635926.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list