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

View source: R/REG.R

REGR Documentation

Regression of Linear Least Square, similar to SAS PROC REG

Description

REG is similar to SAS PROC REG.

Usage

  REG(Formula, Data, conf.level=0.95, HC=FALSE, Resid=FALSE, Weights=1,
      summarize=TRUE)

Arguments

Formula

a conventional formula for a linear model

Data

a data.frame to be analyzed

conf.level

confidence level for the confidence limit

HC

heteroscedasticity-related output is required, such as HC0, HC3, and White's first and second moment specification test

Resid

if TRUE, fitted values (y hat) and residuals will be returned

Weights

weights for each observation, usually the inverse of each variance. This should be a scalar or a vector of the same length as the number of rows of Data. Observations with nonpositive weights are excluded from the analysis, as SAS does.

summarize

If this is FALSE, REG returns just the lfit result.

Details

It performs the core function of SAS PROC REG.

Value

The result is comparable to that of SAS PROC REG.

The first part is the ANOVA table.

The second part is measures of fitness.

The third part is the estimates of coefficients.

Estimate

point estimate of parameters, coefficients

Estimable

estimability: 1=TRUE, 0=FALSE. This appears only when at least one inestimability occurs.

Std. Error

standard error of the point estimate

Lower CL

lower confidence limit with conf.level

Upper CL

upper confidence limit with conf.level

Df

degrees of freedom

t value

value for the t distribution

Pr(>|t|)

probability of a larger absolute t value from the t distribution with the residual's degrees of freedom

The above result is repeated using HC0 and HC3, followed by White's first and second moment specification test, if the HC option is specified. The t values and their p values with HC1 and HC2 are between those of HC0 and HC3.

Fitted

Fitted value or y hat in the original scale as SAS OUTPUT P= does, even with Weights. This is returned only with the Resid=TRUE option.

Residual

Residuals in the original scale as SAS OUTPUT R= does, even with Weights. This is returned only with the Resid=TRUE option.

If summarize=FALSE, REG returns;

coefficients

beta coefficients

g2

g2 inverse

rank

rank of the model matrix

DFr

degrees of freedom for the residual

SSE

sum of squared errors

Author(s)

Kyun-Seop Bae k@acr.kr

See Also

lr

Examples

  REG(uptake ~ Plant + Type + Treatment + conc, CO2)
  REG(uptake ~ conc, CO2, HC=TRUE)
  REG(uptake ~ conc, CO2, Resid=TRUE)
  REG(uptake ~ conc, CO2, HC=TRUE, Resid=TRUE)
  REG(uptake ~ conc, CO2, summarize=FALSE)

sasLM documentation built on June 15, 2026, 9:07 a.m.