Hello,

I am trying to predict using a fixed effects model on an unbalanced
panel. I tried using the code in the example but the fitted values I
get are very different from the fitted values using observed value -
residual. I am giving my code  snippet here:

train_data <- 
na.omit(read.csv(file="usersessions-with-char-sec-train-subset-100.csv",
header=TRUE, row.names = NULL, sep="|"))

panel.data.train <- plm.data(train_data, index = c("session_start","userid"))

mdl_fe <-plm(session_length~age+session_length_mvavg, data =
panel.data.train, model = "within")

##Summaries
summary(mdl_fe)
fixefs <- fixef(mdl_fe)[index(mdl_fe, which = "userid")]
fit_hand <- fixefs + mdl_fe$coefficients[1] * panel.data.train$age +
mdl_fe$coefficients[2] * panel.data.train$session_length_mvavg
fitval <- panel.data.train$session_length-mdl_fe$residuals

Also when I tried the prediction function from the prediction package,
I get the following error:
Error in crossprod(beta, t(X)) : non-conformable arguments

Any help is appreciated.

Thanks!
Jayashree

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to