Dear John,

Thank you very much for the solution and the suggestion. I have tried the
following;

plm1 <- plm(formula = log(gva_ind) ~  poly(x1, 2, raw=TRUE) +
heat*debt_dummy + tt, data = df, index=c("region","year"))

Ef.hd <- Effect(c("heat", "debt_dummy"), plm1)

But get the following error;  - Error in UseMethod("droplevels") : no
applicable method for 'droplevels' applied to an object of class "NULL"

Is this something to do with the way the plm object? Thanks again!

Sincerely,

Milu

On Thu, Sep 6, 2018 at 1:12 AM Fox, John <j...@mcmaster.ca> wrote:

> 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.
>

        [[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.

Reply via email to