Learn R Programming

survival (version 3.8-3)

yates: Population prediction

Description

Compute population marginal means (PMM) from a model fit, for a chosen population and statistic.

Usage

yates(fit, term, population = c("data", "factorial", "sas"),
levels, test = c("global", "trend", "pairwise"), predict = "linear",
options, nsim = 200, method = c("direct", "sgtt"))

Value

an object of class yates with components of

estimate

a data frame with one row for each level of the term, and columns containing the level, the mean population predicted value (mppv) and its standard deviation.

tests

a matrix giving the test statistics

mvar

the full variance-covariance matrix of the mppv values

summary

optional: any further summary if the values provided by the prediction method.

Arguments

fit

a model fit. Examples using lm, glm, and coxph objects are given in the vignette.

term

the term from the model whic is to be evaluated. This can be written as a character string or as a formula.

population

the population to be used for the adjusting variables. User can supply their own data frame or select one of the built in choices. The argument also allows "empirical" and "yates" as aliases for data and factorial, respectively, and ignores case.

levels

optional, what values for term should be used.

test

the test for comparing the population predictions.

predict

what to predict. For a glm model this might be the 'link' or 'response'. For a coxph model it can be linear, risk, or survival. User written functions are allowed.

options

optional arguments for the prediction method.

nsim

number of simulations used to compute a variance for the predictions. This is not needed for the linear predictor.

method

the computational approach for testing equality of the population predictions. Either the direct approach or the algorithm used by the SAS glim procedure for "type 3" tests.

Author

Terry Therneau

Details

The many options and details of this function are best described in a vignette on population prediction.

Examples

Run this code
fit1 <- lm(skips ~ Solder*Opening + Mask, data = solder)
yates(fit1, ~Opening, population = "factorial")

fit2 <- coxph(Surv(time, status) ~ factor(ph.ecog)*sex + age, lung)
yates(fit2, ~ ph.ecog, predict="risk")  # hazard ratio

Run the code above in your browser using DataLab