report.lsmeans: 'LS Means' statistics reporting

Description Usage Arguments Details Value See Also Examples

View source: R/report.lsmeans.R

Description

Creates a desc object for "LS Means" statistics reporting.

For more examples see the website: ClinReport website

Usage

1
2
3
report.lsmeans(lsm, at.row = NULL, infer = c(T, T), round = 2, x1,
  x2, x3, x1.name, x2.name, x3.name, data, contrast, contrast.name, type,
  transpose = FALSE, y.label = NULL)

Arguments

lsm

emmGrid object (result of a emmeans call)

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 summary.emmGrid function.

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

Details

You can produce formatted Least Square Means table for up to 3 factors. It doesn't work for quantitative covariates.

See examples below.

Value

A desc object that can be used by the report.doc function.

See Also

report.quali emmeans report.doc desc

Examples

 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)

ClinReport documentation built on Sept. 3, 2019, 5:07 p.m.