Description Usage Arguments Details Value See Also Examples
View source: R/report.lsmeans.R
Creates a desc object for "LS Means" statistics reporting.
For more examples see the website: ClinReport website
1 2 3  | 
lsm | 
 emmGrid object (result of a   | 
at.row | 
 Character. Passed to spacetable function. Used to space the results per levels of the mentioned variable  | 
infer | 
 A vector of one or two logical values. Passed to   | 
round | 
 Numeric. Specify the number of digits to round the statistics  | 
x1 | 
 deprecated  | 
x2 | 
 deprecated  | 
x3 | 
 deprecated  | 
x1.name | 
 deprecated  | 
x2.name | 
 deprecated  | 
x3.name | 
 deprecated  | 
data | 
 deprecated  | 
contrast | 
 deprecated  | 
contrast.name | 
 deprecated  | 
type | 
 deprecated  | 
transpose | 
 Logical. If TRUE Statistics will be reported in columns  | 
y.label | 
 Character Indicates the label for y parameter to be displayed in the title of the table  | 
You can produce formatted Least Square Means table for up to 3 factors. It doesn't work for quantitative covariates.
See examples below.
A desc object that can be used by the report.doc function.
report.quali emmeans report.doc desc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66  | library(emmeans)
library(lme4)
data(datafake)
#Simple lm model
mod=lm(Petal.Width~Species,data=iris)
raw.lsm=emmeans(mod,~Species)
report.lsmeans(raw.lsm)
# You can display the Statistics in columns
report.lsmeans(raw.lsm,transpose=TRUE)
# In case of just one intercept 
mod=glm(Species~1,data=iris,family=binomial)
raw.lsm=emmeans(mod,~1)
report.lsmeans(raw.lsm)
# Display statistics in columns
report.lsmeans(raw.lsm,transpose=TRUE)
#Mixed model example using lme4
mod=lmer(y_numeric~GROUP+TIMEPOINT+GROUP*TIMEPOINT+(1|SUBJID),data=datafake) 
raw.lsm=emmeans(mod,~GROUP|TIMEPOINT)
report.lsmeans(lsm=raw.lsm,at="TIMEPOINT")
# Display statistics in columns
report.lsmeans(lsm=raw.lsm,at="TIMEPOINT",transpose=TRUE)
# LM model with specific contrast
warp.lm <- lm(breaks ~ wool+tension+wool:tension, data = warpbreaks)
warp.emm <- emmeans(warp.lm, ~ tension | wool)
contr=contrast(warp.emm, "trt.vs.ctrl", ref = "M")
report.lsmeans(lsm=contr,at="wool")
# Display statistics in columns
report.lsmeans(lsm=contr,at="wool",transpose=TRUE)
# Cox model
library(survival)
data(time_to_cure)
fit <- coxph(Surv(time, status) ~ Group, data = time_to_cure) 
em=emmeans(fit,~Group,type="response")
pairs=pairs(em,adjust="none",exclude="Untreated")
pairs
report.lsmeans(pairs)
# Display statistics in columns
report.lsmeans(pairs,transpose=TRUE)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.