I am trying to run glmm for my data and I have top models for all my target species. However, when I try to plot them with log odds, all the coefficients show up. When I try to select just one coefficient (for e.g. Predator and Aspect), one part of that coefficient is always missing from the graph (e.g. "Yes" shows up, "No" is missing, "NE" is missing from Aspect), drawing the intercept doesn't work as well because the intercept includes part of all other coefficients as well. I want to plot it like this
Dummy data is as follows:
Number <- c(25,16,16,13,12,9,15,25,4,5,230,259,224,259,588,604,583,576,599,664)
Location <- c("Borakolalo","Borakolalo","Borakolalo","Borakolalo","Bloemhof","Bloemhof","Bloemhof",
"Bloemhof","Boskop","Boskop","Boskop","Boskop","Kgaswane","Kgaswane","Kgaswane",
"Kgaswane","Mafikeng","Mafikeng","Mafikeng","Mafikeng")
Nitrogen<-c(0.0889,0.0406,0.0835,0.0737,0.0578,0.0806,0.0914,0.09630,0.0718,0.08955,1.0211,1.9489,
1.9808,1.0053,1.9682,1.9794,1.0959,1.0028,1.9281,1.9887)
Dist_water<- c(2156.0,3783.8,3285.8,2574.7,2242.3,2729.5,2418.1,2874.9,2869.0,2563.0,257.1,660.4,
440.4,417.7,562.6,528.5,426.5,591.2,435.9,306.5)
Predator<-c("Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","No","No","No","No",
"No","No","No","No","No","No")
Aspect<-c("SE","S","S","NE","NW","S","SW","SE","S","S","NE",
"S","S","SE","SE","SE","SE","SE","SE","SE")
bles<-data.frame(Number,Location,Nitrogen,Dist_water,Predator,Aspect)
bles_sc <- transform(bles,
Nitrogen = drop(scale(Nitrogen)),
Dist_water = drop(scale(Dist_water)))
library(lme4)
mod<-glmer.nb(Number~Nitrogen + Dist_water + Predator+Aspect+(1|Location), data=bles_sc)
summary(mod)
I want to create coefficient plots for all my significant coefficients. I have tried coefplot, coefplot2, multiplot and effect_plot but nothing gives me the result like the image. With most plots, for selected coefficients, Number comes up on the Y-axis not log odds ratios. Any help would be appreciated.
cat_plot(mod, pred = Predator, modx = NULL, interval = TRUE)
coefplot(mod,vertical=FALSE, col="black", hoffset=0.4, horizontal = TRUE, coefficients=c("(Intercept)","PredatorYes","PredatorNo"), strict=TRUE,
ylab="Predator", xlab="Log Odd Ratios")
coefplot2(mod,vertical=FALSE, frame.plot=TRUE, var.las=1,cex.var=0.5,
intercept=TRUE, CI=1)
effect_plot(mod, pred = Predator, outcome.scale = "link",
interval = TRUE)