Learn R Programming

lsmeans (version 2.00-1)

summary: Methods for ref.grid objects

Description

Use these methods to summarize, print, or examine objects of class "ref.grid". They also apply to the class "lsmobj", which is an extension of "ref.grid".

Usage

## S3 method for class 'ref.grid':
summary(object, infer, level, adjust, by, 
    type = c("link","response","lp","linear"), ...)
## S3 method for class 'ref.grid':
predict(object, type = c("link","response","lp","linear"), ...)

## S3 method for class 'ref.grid':
str(object, ...)

## S3 method for class 'ref.grid':
print(x, ...)
## S3 method for class 'summary.ref.grid':
print(x, ..., digits = NULL, quote = FALSE, right = TRUE)

Arguments

object
An object of class "ref.grid".
infer
A vector of two logical values. The first determines whether confidence intervals are displayed, and the second determines whether t tests and P values are displayed. If only one value is provided, it is used for both.
level
Confidence level for confidence intervals, if infer[1] is TRUE.
adjust
Character value naming the method used to adjust P values, if infer[2] is TRUE. "tukey" computes p values using the Studentized range distribution with the number of means in the family; "sidak"
by
Character name(s) of variables to use for grouping. This affects the family of tests considered in adjusted P values. The printed display of the summary is grouped by the by variables.
type
Type of prediction desired. This only has an effect if there is a known transformation or link function. "response" specifies that the inverse transformation be applied. All others are equivalent, and request that results be shown for the lin
x
The object to be printed.
..., digits, quote, right
Additional arguments passed to print.data.frame.

Value

  • The summary method for "ref.grid" objects returns An object of class "summary.ref.grid", which extends "data.frame".

Details

The misc slot in object contains default values for several parameters such as by and infer. The defaults vary depending on the code that created the object. With type="response", the transformation assumed can be found in object@misc$tran, and its label, for the summary is in object@misc$inv.lbl. At this time, tran must be one of the named transformations valid for make.link. Any $t$ or $z$ tests are still performed on the scale of the linear predictor, not the inverse-transformed one. Similarly, confidence intervals are computed on the linear-predictor scale, then inverse-transformed.

See Also

Methods for the closely related "lsmobj" class can be found in contrast, cld, and glht.

Examples

Run this code
require(lsmeans)
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.rg <- ref.grid(warp.lm)
str(warp.rg)

summary(warp.rg)

summary(warp.rg, by = "wool", 
        infer = c(TRUE, FALSE), level = .90)

# Transformed response
sqwarp.rg <- ref.grid(update(warp.lm, sqrt(breaks) ~ .))
summary(sqwarp.rg)

# Back-transformed results - compare with summary of 'warp.rg'
summary(sqwarp.rg, type = "response")

# Logistic regression
# Reshape the Titanic data
Titan <- do.call("expand.grid", dimnames(Titanic)[-4])
Titan$Died <- matrix(Titanic, ncol=2)
Titan.glm <- glm(Died ~ (Class + Sex + Age)^2, 
    family = binomial, data = Titan)
Titan.lsm <- lsmeans(Titan.glm, ~ Class|Sex, at = list(Age="Adult"))
summary(Titan.lsm, type="response")
summary(pairs(Titan.lsm), type="response")

Run the code above in your browser using DataLab