Dear Milu, I get the same error as you with this example -- I tried a different plm model -- which of course is why a reproducible example is a good idea.
Here's where the error is: ----------- snip ----------- > Ef.hd <- Effect(c("pc", "emp", "unemp"), zz) Error in UseMethod("droplevels") : no applicable method for 'droplevels' applied to an object of class "NULL" > traceback() 10: droplevels(index) 9: model.frame.pFormula(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, drop.unused.levels = TRUE) 8: stats::model.frame(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, drop.unused.levels = TRUE) 7: eval(mf, parent.frame()) 6: eval(mf, parent.frame()) 5: glm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, control = list(epsilon = 1, maxit = 1, trace = FALSE)) 4: eval(cl) 3: eval(cl) 2: Effect.default(c("pc", "emp", "unemp"), zz) 1: Effect(c("pc", "emp", "unemp"), zz) ----------- snip ----------- So the error is in model.frame.pFormula(), which is from the plm package. It would probably require substantial effort to get this to work. Best, John > -----Original Message----- > From: Miluji Sb [mailto:miluj...@gmail.com] > Sent: Thursday, September 6, 2018 8:52 AM > To: Fox, John <j...@mcmaster.ca> > Cc: r-help mailing list <r-help@r-project.org> > Subject: Re: [R] Marginal effects with plm > > Dear John, > > Apologies for not providing reproducible example. I just tried with a > plm example but ran into the same issue; > > library(plm) > data("Produc", package = "plm") > zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = > Produc, index = c("state","year")) > > Ef.hd <- Effect(c("pc", "emp", "unemp"), zz) > > Error in UseMethod("droplevels") : > no applicable method for 'droplevels' applied to an object of class > "NULL" > > What am I doing wrong? Thanks again. > > Sincerely, > > Milu ______________________________________________ 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.