如何设置多层模型屏幕输出的小数位数(需显示三位)
Got it, let's sort out how to get your lmer model's display() output to show 3 decimal places!
Since you're using display() (from the arm package, which is standard for summarizing lmer models), the easiest way is to use the built-in digits parameter directly in your call:
# First make sure the arm package is loaded library(arm) # Call display with digits set to 3 display(M3, digits = 3)
This will tweak only the output of this display() call to show exactly three decimal places for coefficients, standard errors, and other numeric values.
If you want all subsequent numeric outputs in your R session to default to three decimal places (not just this model's display), you can set a global option:
# Set global default to 3 decimal places options(digits = 3) # Now display(M3) will automatically use 3 decimals display(M3)
Just keep in mind this affects all numeric printing in your session—if you want to go back to the default (which is 7 digits), run options(digits = 7) later.
内容的提问来源于stack exchange,提问作者Syd06

