Error: $ Operator Not Defined for This S4 Class

Error: $ operator not defined for this S4 class

You are giving as.formula the wrong input here. Only d$sex ~ d$ahe should be a formula, so:

ctree(as.formula("d$sex ~ d$ahe"))

Or:

ctree(as.formula("sex ~ ahe"), data = d)

stargazer Error: $ operator not defined for this S4 class

This kind of model does not appear to be supported by stargazer, but it is supported by the modelsummary package. (Disclaimer: I am the author.)

library(panelr)
library(modelsummary)

wages <- panel_data(WageData, id = id, wave = t)
mod <- wbm(lwage ~ union, data = dat)

modelsummary(mod)


































































Model 1
union0.055
(0.025)
(Intercept)6.675
(0.021)
imean(union)0.003
(0.036)
SD (Intercept)0.382
SD (Observations)0.259
Num.Obs.4165
R2 Marg.0.000
R2 Cond.0.685
AIC2262.8
BIC2294.5
RMSE0.24

Error: $ operator not defined for this S4 class when trying to run vuong() function

As you discovered, pscl::vuong doesn't work with lmer models.

There is a nonnest package with a vuongtest function. From the example in that help page:

## Supplying custom vcov function
require(lme4)
require(merDeriv)

fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy, REML=FALSE)
fm2 <- lmer(Reaction ~ Days + (Days || Subject), sleepstudy, REML=FALSE)

vcl <- function(obj) vcov(obj, full=TRUE)
vuongtest(fm1, fm2, vc1=vcl, vc2=vcl, nested=TRUE)


Related Topics



Leave a reply



Submit