strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science

Home Page:https://strengejacke.github.io/sjPlot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confidence intervals not extending all the way along line

adityac95 opened this issue · comments

Hi, thanks for your great package.

I built a linear mixed effects model called em_lmer_cadencesc_priors_props_int with the following formula:

response ~ prior_dcs 
           + prior_dcs:proportion_dcs 
           + (1|stim_id) 
           + (prior_dcs + prior_dcs:proportion_dcs||participant_private_id)

Having fit the model, I subsequently tried to plot it using sjPlot's plot_model function as follows:

plot_model(em_lmer_cadencesc_priors_props_int,
           type='pred',
           terms=c('prior_dcs','cadence_sum_contrast','proportion_dcs [.2,.5,.8]'))

However, the confidence intervals are only displayed part-way along the lines:

image

Is there any way to get them to extend the whole way along? The maximum possible value of prior_dcs is 20.

BTW, when I plot at just a single level of proportion_dcs, the confidence interval extends all the way:

plot_model(em_lmer_cadencesc_priors_props_int,
           type='pred',
           terms=c('prior_dcs','cadence_sum_contrast','proportion_dcs [.2,]'))

image

Hi, I'm still having this issue -- any ideas?

commented

the range of ylim (see ?ggplot2::ylim) is not large enough. I suggest using ggpredict() directly, the plot() method is more flexible (see also https://strengejacke.github.io/ggeffects/articles/introduction_plotmethod.html#control-y-axis-appearance).

You could do

library(ggeffects)
pr <- ggpredict(
  em_lmer_cadencesc_priors_props_int,
  terms=c('prior_dcs','cadence_sum_contrast','proportion_dcs [.2,.5,.8]')
)
plot(pr, limits = c(0, 20))