LSM | R Documentation |

Estimates least square means using g2 inverse.

```
LSM(Formula, Data, Term, conf.level=0.95, adj="lsd", hideNonEst=TRUE,
PLOT=FALSE, descend=FALSE, ...)
```

`Formula` |
a conventional formula of model |

`Data` |
data.frame |

`Term` |
term name to be returned. If there is only one independent variable, this can be omitted. |

`conf.level` |
confidence level for the confidence limit |

`adj` |
adjustment method for grouping, "lsd"(default), "tukey", "bon", "duncan", "scheffe" are available. This does not affects SE, Lower CL, Upper CL of the output table. |

`hideNonEst` |
logical. hide non-estimables |

`PLOT` |
logical. whether to plot LSMs and their confidence intervals |

`descend` |
logical. This specifies the plotting order be ascending or descending. |

`...` |
arguments to be passed to |

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. For adjust method "dunnett", see `PDIFF`

function.

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

`Group` |
group character. This appears with one-way ANOVA or |

`LSmean` |
point estimate of least square mean |

`LowerCL` |
lower confidence limit with the given confidence level by "lsd" method |

`UpperCL` |
upper confidence limit with the given confidence level by "lsd" method |

`SE` |
standard error of the point estimate |

`Df` |
degree of freedom of point estimate |

Kyun-Seop Bae k@acr.kr

`PDIFF`

, `Diffogram`

```
LSM(uptake ~ Type, CO2[-1,])
LSM(uptake ~ Type - 1, CO2[-1,])
LSM(uptake ~ Type*Treatment + conc, CO2[-1,])
LSM(uptake ~ Type*Treatment + conc - 1, CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + log(conc), CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + log(conc) - 1, CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + as.factor(conc), CO2[-1,])
LSM(log(uptake) ~ Type*Treatment + as.factor(conc) - 1, CO2[-1,])
LSM(log(CMAX) ~ SEQ/SUBJ + PRD + TRT, BEdata)
LSM(log(CMAX) ~ SEQ/SUBJ + PRD + TRT - 1, BEdata)
```

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.