Description Usage Arguments Details Value Note Author(s) See Also Examples

These functions and methods provide an interface between lsmeans and the `glht`

function for simultaneous inference in the multcomp package.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## S3 method for class 'ref.grid'
as.glht(object, ...)
## S3 method for class 'lsm.list'
as.glht(object, ..., which = 1)
## S3 method for class 'glht.list'
coef(object, ...)
## S3 method for class 'glht.list'
confint(object, ...)
## S3 method for class 'glht.list'
plot(x, ...)
## S3 method for class 'glht.list'
summary(object, ...)
## S3 method for class 'glht.list'
vcov(object, ...)
lsm(...)
pmm(...)
``` |

`object, x` |
An object of the required class. |

`which` |
Numeric index of which element of the |

`...` |
Additional arguments to other methods. |

`lsm`

(and `pmm`

, which is identical) are meant to be called only *from* `"glht"`

as its second (`linfct`

) argument. It works similarly to `mcp`

except with `specs`

(and optionally `by`

and `contr`

arguments) provided as in a call to `lsmeans`

or `pmmeans`

.

When there is a non-`NULL`

`by`

variable (either explicitly or implicitly), each “by” group is passed separately to `glht`

and returned as a `list`

of `"glht"`

objects. For convenience, this is classed as `"glht.list"`

, and appropriate methods `coef`

, `confint`

, `plot`

, `summary`

, and `vcov`

are provided.

`as.glht`

returns an object of class `glht`

, or of class `glht.list`

if `by`

is non-`NULL`

. The latter is simply a list of `glht`

objects, and the provided methods `coef`

, `confint`

, `plot`

, `summary`

, and `vcov`

simply `lapply`

the corresponding methods for class `"glht"`

.

There is also a `glht`

method for class `ref.grid`

, but it is far preferable to use `as.glht`

instead, as its `model`

argument is redundant.

Russell V. Lenth

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
require(lsmeans)
require(multcomp)
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
# Using 'lsm'
summary(glht(warp.lm, lsm(pairwise ~ tension | wool)))
# Same, but using an existing 'lsmeans' result
warp.lsmobj <- lsmeans(warp.lm, ~ tension | wool)
summary(as.glht(pairs(warp.lsmobj)))
# Same contrasts, but treat as one family
summary(as.glht(pairs(warp.lsmobj), by = NULL))
``` |

```
Loading required package: estimability
Loading required package: multcomp
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS
Attaching package: 'TH.data'
The following object is masked from 'package:MASS':
geyser
Note: df set to 48
$`wool = A`
Simultaneous Tests for General Linear Hypotheses
Fit: lm(formula = breaks ~ wool * tension, data = warpbreaks)
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
L - M == 0 20.5556 5.1573 3.986 0.000666 ***
L - H == 0 20.0000 5.1573 3.878 0.000882 ***
M - H == 0 -0.5556 5.1573 -0.108 0.993624
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
$`wool = B`
Simultaneous Tests for General Linear Hypotheses
Fit: lm(formula = breaks ~ wool * tension, data = warpbreaks)
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
L - M == 0 -0.5556 5.1573 -0.108 0.994
L - H == 0 9.4444 5.1573 1.831 0.170
M - H == 0 10.0000 5.1573 1.939 0.139
(Adjusted p values reported -- single-step method)
Note: df set to 48
$`wool = A`
Simultaneous Tests for General Linear Hypotheses
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
L - M == 0 20.5556 5.1573 3.986 0.000606 ***
L - H == 0 20.0000 5.1573 3.878 0.000909 ***
M - H == 0 -0.5556 5.1573 -0.108 0.993623
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
$`wool = B`
Simultaneous Tests for General Linear Hypotheses
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
L - M == 0 -0.5556 5.1573 -0.108 0.994
L - H == 0 9.4444 5.1573 1.831 0.170
M - H == 0 10.0000 5.1573 1.939 0.139
(Adjusted p values reported -- single-step method)
Note: df set to 48
Simultaneous Tests for General Linear Hypotheses
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
L - M, A == 0 20.5556 5.1573 3.986 0.00131 **
L - H, A == 0 20.0000 5.1573 3.878 0.00185 **
M - H, A == 0 -0.5556 5.1573 -0.108 0.99996
L - M, B == 0 -0.5556 5.1573 -0.108 0.99996
L - H, B == 0 9.4444 5.1573 1.831 0.30798
M - H, B == 0 10.0000 5.1573 1.939 0.25531
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.