0

I'm trying to arrange two coefplot objects into one graph via the par(mfrow(,)) method, but it didn't work out. What did I do wrong? Or is that coefplot just doesn't work this way? What will be alternative method? I've referenced this earlier thread, but I tend to think that mine is a quite different issue.

# load the data
dat <- readRDS(url("https://www.dropbox.com/s/88h7hmiroalx3de/act.rds?dl=1"))


#fit two models
library(lmer4)

act1.fit <- glmer(act1 ~ os + education + marital + nat6 + nat5 + nat4 + nat3 + nat2 + nat1 + 
    (1 | region_id), data = action, family = binomial, control = glmerControl(optimizer = "bobyqa"),
    nAGQ = 10)
    
action2.fit <- glmer(act2 ~ os + education + marital + nat6 + nat5 + nat4 + nat3 + nat2 + nat1 + 
    (1 | region_id), data = action, family = binomial, control = glmerControl(optimizer = "bobyqa"),
    nAGQ = 10)
    

# plot the two model individually
library(coefplot)

# construct coefplot objects

coefplot:::buildModelCI(action1.fit)
         
coefplot:::buildModelCI(action2.fit)
coefplot(action2.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"), 
         intercept = FALSE, color = "brown3")
         
# arrange two plots in one graph
par(mfrow=c(1,2))
coefplot(action1.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"), 
         intercept = FALSE, color = "brown3")
         
coefplot(action2.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"), 
         intercept = FALSE, color = "brown3")         

# didn't work ???
Chris T.
  • 1,181
  • 3
  • 17
  • 32

0 Answers0