Learn R Programming

sasLM (version 0.5.0)

LSM: Least Square Means

Description

Estimates least square means using g2 inverse.

Usage

LSM(Formula, Data, conf.level=0.95)

Arguments

Formula

a conventional formula of model

Data

data.frame

conf.level

confidence level for the confidence limit

Value

Returns a table of expectations, t values and p-values.

LSmean

point estimate of least square mean

LowerCL

lower confidence limit with the given confidence level

UpperCL

upper confidence limit with the given confidence level

SE

standard error of the point estimate

Df

degree of freedom of point estimate

Details

It corresponds to SAS PROC GLM LSMEANS. The result of the second example below may be different from emmeans. This is because SAS or this function calculates mean of the transformed continuous variable. However, emmeans calculates the average before the transformation. Interaction of three variables is not supported yet.

Examples

Run this code
# NOT RUN {
LSM(uptake ~ Type*Treatment + conc, CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + log(conc), CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + as.factor(conc), CO2[-1,])
LSM(log(CMAX) ~ SEQ/SUBJ + PRD + TRT, BEdata)
# }

Run the code above in your browser using DataLab