I am using the wbm()
from the panelr package by Prof Long (https://panelr.jacob-long.com/articles/wbm.html) to fit a within-between (mixed-effects) model.
I wanted to find out how to do residual or model diagnostics. For example, fitting a model with betareg
in r
, the following chunk of code gives me the following plots
par(mfrow=c(3,2))
plot(fit1, which = 1:4, type = "pearson")
plot(fit1, which = 5, type = "deviance", sub.caption = "")
plot(fit1, which = 1, type = "deviance", sub.caption = "")
But when I run the regression (model named fit3) using wbm()
and I run the code to get the diagnostics plots
par(mfrow=c(3,2))
plot(fit3, which = 1:4, type = "pearson")
plot(fit3, which = 5, type = "deviance", sub.caption = "")
plot(fit3, which = 1, type = "deviance", sub.caption = "")
EDIT Below is a MWE based on data from the package:
#Load Package
library(panelr)
#Load teen_poverty data from package
data("WageData")
head(WageData)
#Declare data as panel
Wages <- panel_data(WageData, id = id, wave = t)
Wages
#Run a "contextual" model
fit3 <- wbm(lwage ~ wks + union + ms + occ | blk + fem, data = Wages, model = "contextual")
summary(fit3)
#Model/Residual Diagnostics
par(mfrow=c(3,2))
plot(fit3, which = 1:4, type = "pearson")
plot(fit3, which = 5, type = "deviance", sub.caption = "")
plot(fit3, which = 1, type = "deviance", sub.caption = "")
I would be grateful if someone could help direct me as to how I can get the appropriate plots when I run a model using wbm()
?
Thank you.