Dear Milu, Depending upon what you mean by "marginal effects," you might try the effects package. For example, for your model, try
(Ef.hd <- Effect(c("heat", "debt_dummy"), plm1)) plot(Ef.hd) A couple of comments about the model: I'd prefer to specify the formula as log(y) ~ poly(x1, 2) + heat*debt + tt or log(y) ~ poly(x1, 2, raw=TRUE) + heat*debt + tt (assuming that debt_dummy is a precoded dummy regressor for a factor debt). I hope this helps, John -------------------------------------- John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web: socialsciences.mcmaster.ca/jfox/ > -----Original Message----- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Miluji > Sb > Sent: Wednesday, September 5, 2018 6:30 PM > To: r-help mailing list <r-help@r-project.org> > Subject: [R] Marginal effects with plm > > Dear all, > > I am running the following panel regression; > > plm1 <- plm(formula = log(y) ~ x1 + I(x1^2) + heat*debt_dummy + tt, data > = df, index=c("region","year")) > > where 'df' is a pdata.frame. I would like to obtain marginal effects of > 'y' > for the variable 'x1'. I have tried the packages 'prediction' and > 'margins' > without luck. > > Is it possible to obtain marginal effects with 'plm'? Any help will be > highly appreciated. Thank you. > > Error in UseMethod("predict") : > no applicable method for 'predict' applied to an object of class > "c('plm', 'panelmodel')" > > Sincerely, > > Milu > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. ______________________________________________ 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.