runLinearModel: Run the linear model using the selected variables

Description Usage Arguments Value Examples

View source: R/semmsFuncs.R

Description

Run glm with the selected variables (identified by nnt) as predictors.

Usage

1
runLinearModel(dat, nnt, distr, func = "glm")

Arguments

dat

The dataset, as generated by readInputFile().

nnt

The column numbers in the Z matrix of the non-null variables.

distr

The distribution to use when fitting the linear model (N=gaussian, P=poisson, or B=binomial).

func

The function to use when fitting the model: glm or lm (default=glm).

Value

Z

A numeric matrix of putative variables (in the columns)

mod

The object returned from glm or lm.

aic

The AIC of the model.

vif

The variance inflation factors (if more than one variable is used in the model).

Examples

1
2
3
4
5
6
7
## Not run: 
fn <- system.file("extdata", "AR1SIM.RData", package = "SEMMS", mustWork = TRUE)
dataYXZ <- readInputFile(fn, ycol=1, Zcols=2:100)
fittedSEMMS <- fitSEMMS(dataYXZ, mincor=0.8, nn=15, minchange= 1,
                        distribution="N",verbose=T,rnd=F)
fittedGLM <- runLinearModel(dataYXZ,fittedSEMMS$gam.out$nn, "N")
## End(Not run)

haimbar/SEMMS documentation built on Dec. 20, 2021, 2:44 p.m.