Learn R Programming

sasLM (version 0.10.7)

'SAS' Linear Model

Description

This is a core implementation of 'SAS' procedures for linear models - GLM, REG, ANOVA, TTEST, FREQ, and UNIVARIATE. Some R packages provide type II and type III SS. However, the results of nested and complex designs are often different from those of 'SAS.' Different results does not necessarily mean incorrectness. However, many wants the same results to SAS. This package aims to achieve that. Reference: Littell RC, Stroup WW, Freund RJ (2002, ISBN:0-471-22174-0).

Copy Link

Version

Install

install.packages('sasLM')

Monthly Downloads

775

Version

0.10.7

License

GPL-3

Maintainer

Kyun-Seop Bae

Last Published

September 28th, 2025

Functions in sasLM (0.10.7)

N

Number of observations
LSM

Least Square Means
OBFBound

O'Brien-Flemming bounds for cumulative Z-test in Group Sequential Design
Max

Max without NA
Mean

Mean without NA
Median

Median without NA
ORmn

Odds Ratio and Score CI of two groups with strata by MN method
ModelMatrix

Model Matrix
Min

Min without NA
QuartileRange

Inter-Quartile Range
G2SWEEP

Generalized inverse matrix of type 2 for linear regression
PocockBound

Pocock (fixed) Bound for the cumulative Z-test with a final target alpha-value
RD

Risk Difference between two groups
ORinv

Odds Ratio of two groups with strata by inverse variance method
OR

Odds Ratio of two groups
Pcor.test

Partial Correlation test of multiple columns
ORcmh

Odds Ratio of two groups with strata by CMH method
ORmn1

Odds Ratio and Score CI of two groups without strata by the MN method
PDIFF

Pairwise Difference
RDinv

Risk Difference between two groups with strata by inverse variance method
RR

Relative Risk of the two groups
RDmn1

Risk Difference and Score CI between two groups without strata by the MN method
RDmn

Risk Difference and Score CI between two groups with strata by the MN method
REG

Regression of Linear Least Square, similar to SAS PROC REG
RRinv

Relative Risk of two groups with strata by inverse variance method
ScoreCI

Score Confidence Interval for a Proportion or a Binomial Distribution
Skewness

Skewness
SD

Standard Deviation
SEM

Standard Error of the Sample Mean
SLICE

F Test with Slice
SS

Sum of Square
Range

Range
UCL

Upper Confidence Limit
RanTest

Test with Random Effects
UNIV

Univariate Descriptive Statistics
T3MS

Type III Expected Mean Square Formula
WhiteTest

White's Model Specification Test
SkewnessSE

Standard Error of Skewness
af

Convert some columns of a data.frame to factors
RRmn

Relative Risk and Score CI of two groups with strata by the MN method
e1

Get a Contrast Matrix for Type I SS
corFisher

Correlation test by Fisher's Z transformation
aov2

ANOVA with Type II SS
aov1

ANOVA with Type I SS
cSS

Sum of Square with a Given Contrast Set
lr

Linear Regression with g2 inverse
lfit

Linear Fit
estmb

Estimability Check
bk

Beautify the output of knitr::kable
est

Estimate Linear Functions
RRmn1

Relative Risk and Score CI of two groups without strata by by MN method
T3test

Test Type III SS using error term other than MSE
aov3

ANOVA with Type III SS
TTEST

Independent two groups t-test comparable to PROC TTEST
is.cor

Is it a correlation matrix?
geoMean

Geometric Mean without NA
pB

Plot Confidence and Prediction Bands for Simple Linear Regression
seqBound

Sequential bounds for cumulative Z-test in Group Sequential Design
seqCI

Confidence interval with the last Z-value for the group sequential design
pD

Diagnostic Plot for Regression
g2inv

Generalized type 2 inverse matrix, g2 inverse
sasLM-package

'SAS' Linear Model
satt

Satterthwaite Approximation of Variance and Degree of Freedom
regD

Regression of Conventional Way with Rich Diagnostics
geoCV

Geometric Coefficient of Variation in percentage
pResD

Residual Diagnostic Plot for Regression
tsum3

Table Summary 3 independent(x) variables
tsum

Table Summary
tsum0

Table Summary 0 independent(x) variable
aspirinCHD

An example data for meta-analysis - aspirin in coronary heart disease
tsum2

Table Summary 2 independent(x) variables
tsum1

Table Summary 1 independent(x) variable
vtest

F-Test for the ratio of two groups' variances
ztest

Test for the difference of two groups' means
lr0

Simple Linear Regressions with Each Independent Variable
tmtest

Independent two means test similar to t.test with summarized input
e2

Get a Contrast Matrix for Type II SS
e3

Get a Contrast Matrix for Type III SS
trimmedMean

Trimmed Mean
mtest

Independent two groups t-test similar to PROC TTEST with summarized input
CONTR

F Test with a Set of Contrasts
BasicUtil

Internal Functions
Diffogram

Plot Pairwise Differences
CV

Coefficient of Variation in percentage
Cor.test

Correlation test of multiple numeric columns
Coll

Collinearity Diagnostics
BY

Analysis BY variable
KurtosisSE

Standard Error of Kurtosis
CIest

Confidence Interval Estimation
LCL

Lower Confidence Limit
BEdata

An Example Data of Bioequivalence Study
CumAlpha

Cumulative Alpha with various z's and ti
ExitP

Exit Probability with cumulative Z-test in Group Sequential Design
EMS

Expected Mean Square Formula
ESTM

Estimate Linear Function
DoEdata

Example Datasets
Drift

Drift defined by Lan and DeMets for Group Sequential Design
GLM

General Linear Model similar to SAS PROC GLM
Kurtosis

Kurtosis