You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于sjt.lmer输出表格显示错误p值的技术咨询

Troubleshooting Incorrect p-values in sjt.lmer Output

Hey there, sorry to hear you're stuck with this p-value mismatch issue! Based on what you described—where summary() and p_value() give consistent results but sjt.lmer outputs wrong p-values, and this only started happening recently—it’s almost certainly a bug introduced in a recent update to the sjPlot package.

Here are actionable steps to diagnose and fix this:

1. Check your sjPlot version

First, confirm which version of sjPlot you’re running now:

packageVersion("sjPlot")

Compare this to the version you used last month (if you can remember it). A version update is the most likely cause of the sudden break.

2. Downgrade to a working version

If you can pinpoint the version that worked correctly, you can roll back using devtools (install it first if you haven’t):

# Install devtools if needed
install.packages("devtools")
# Replace X.X.X with the version that worked last month
devtools::install_version("sjPlot", version = "X.X.X", repos = "http://cran.us.r-project.org")

After downgrading, re-run your code to see if sjt.lmer displays correct p-values again.

3. Check for existing bug reports

Head to the sjPlot GitHub repository and browse the Issues section. Search for keywords like "sjt.lmer p-value mismatch" or "incorrect p-values"—other users might have reported the same issue, and there could be a fix or workaround already shared.

4. Temporary workaround

While waiting for an official fix, you can use alternative tools to generate your regression table with correct p-values. For example, the gtsummary package works seamlessly with lme4 models and supports Kenward-Roger p-value approximation (matching your p_value(fit1, p.kr=TRUE) call):

# Install and load gtsummary
install.packages("gtsummary")
library(gtsummary)

# Generate table with correct p-values
fit1 %>%
  tbl_regression(
    pvalue_fun = ~style_pvalue(.x, digits = 3),
    include = c(sex, c12hour, barthel),
    pvalue_method = "kenward-roger"
  )

This will produce a clean, publication-ready table with p-values that align with your model summary.

5. Report the bug (if confirmed)

If you verify this is a new bug in the latest sjPlot version, consider submitting a detailed issue on GitHub. Include your full reproducible code, the versions of sjPlot, lme4, and R you’re using, and screenshots of the mismatched outputs. This helps the package maintainer fix the issue faster for everyone!


内容的提问来源于stack exchange,提问作者Emily Darling

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:47:12