Learn R Programming

sasLM (version 0.10.6)

'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

895

Version

0.10.6

License

GPL-3

Maintainer

Kyun-Seop Bae

Last Published

July 23rd, 2025

Functions in sasLM (0.10.6)

N

Number of observations
Median

Median without NA
Mean

Mean without NA
G2SWEEP

Generalized inverse matrix of type 2 for linear regression
ModelMatrix

Model Matrix
ExitP

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

Odds Ratio of two groups
QuartileRange

Inter-Quartile Range
RRmn1

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

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

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

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

White's Model Specification Test
REG

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

Estimability Check
aov3

ANOVA with Type III SS
aov2

ANOVA with Type II SS
SS

Sum of Square
RanTest

Test with Random Effects
UNIV

Univariate Descriptive Statistics
RR

Relative Risk of the two groups
geoCV

Geometric Coefficient of Variation in percentage
LSM

Least Square Means
ScoreCI

Score Confidence Interval for a Proportion or a Binomial Distribution
ORinv

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

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

Odds Ratio of two groups with strata by CMH method
RRmn

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

Max without NA
RDmn

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

Standard Error of the Sample Mean
RDmn1

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

Geometric Mean without NA
Pcor.test

Partial Correlation test of multiple columns
PDIFF

Pairwise Difference
UCL

Upper Confidence Limit
tsum3

Table Summary 3 independent(x) variables
tsum2

Table Summary 2 independent(x) variables
cSS

Sum of Square with a Given Contrast Set
g2inv

Generalized type 2 inverse matrix, g2 inverse
trimmedMean

Trimmed Mean
tsum

Table Summary
aspirinCHD

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

Independent two groups t-test comparable to PROC TTEST
mtest

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

Beautify the output of knitr::kable
SLICE

F Test with Slice
RD

Risk Difference between two groups
pD

Diagnostic Plot for Regression
pB

Plot Confidence and Prediction Bands for Simple Linear Regression
e1

Get a Contrast Matrix for Type I SS
Skewness

Skewness
corFisher

Correlation test by Fisher's Z transformation
SkewnessSE

Standard Error of Skewness
e2

Get a Contrast Matrix for Type II SS
lr

Linear Regression with g2 inverse
is.cor

Is it a correlation matrix?
lfit

Linear Fit
lr0

Simple Linear Regressions with Each Independent Variable
pResD

Residual Diagnostic Plot for Regression
seqCI

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

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

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

Satterthwaite Approximation of Variance and Degree of Freedom
ztest

Test for the difference of two groups' means
Range

Range
T3MS

Type III Expected Mean Square Formula
SD

Standard Deviation
regD

Regression of Conventional Way with Rich Diagnostics
T3test

Test Type III SS using error term other than MSE
est

Estimate Linear Functions
e3

Get a Contrast Matrix for Type III SS
tmtest

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

Table Summary 0 independent(x) variable
tsum1

Table Summary 1 independent(x) variable
RDinv

Risk Difference between two groups with strata by inverse variance method
sasLM-package

'SAS' Linear Model
af

Convert some columns of a data.frame to factors
aov1

ANOVA with Type I SS
CumAlpha

Cumulative Alpha for the Fixed Z-value
BY

Analysis BY variable
CONTR

F Test with a Set of Contrasts
Diffogram

Plot Pairwise Differences
LCL

Lower Confidence Limit
KurtosisSE

Standard Error of Kurtosis
BEdata

An Example Data of Bioequivalence Study
BasicUtil

Internal Functions
DoEdata

Example Datasets
GLM

General Linear Model similar to SAS PROC GLM
Kurtosis

Kurtosis
CV

Coefficient of Variation in percentage
Coll

Collinearity Diagnostics
ESTM

Estimate Linear Function
Min

Min without NA
CIest

Confidence Interval Estimation
EMS

Expected Mean Square Formula
Cor.test

Correlation test of multiple numeric columns
Drift

Drift defined by Lan and DeMets for Group Sequential Design