Description Usage Arguments Details Value Author(s) Examples
Terms are added iteratively to a regression model until the improvement in fit (judged by the Pvalue for a partial ttest or score test) is no longer signicant at a specified threshold. The method implemented here makes use of a prebuilt sufficient summary statistic matrix, which contains the (weighted) second moments between all the variables that are being assessed for inclusion in the regression model. The calculations are exact for a normal linear model and correspond to a score test for a generalised linear model.
1 2  stepup.moments2(xtwx, leftvar, biggest, smallest,
p.thresh = 0.05, n = NULL, vscale = NULL)

xtwx 
a matrix of (weighted) second moments, typically built using

leftvar 
name of the response variable (the left hand side of the formula). 
biggest 
name(s) of the explanatory variables in the biggest model to fit, i.e.\ variables to consider for inclusion. 
smallest 
name(s) of the explanatory variables in the smallest model to fit, i.e.\ variables that must be included. 
p.thresh 
Pvalue threshold for proceeding to add a term to the model. 
n 
sample size, only needed for the normal linear model if there is not a single intercept
“ 
vscale 
parameter, set to 
This performs stepwise upward model selection. Significance of terms
considered for inclusion is determined using identical calculations to
lm.moments2
and est.moments2
.
When the vscale
argument is NULL
this function assumes
that the xtwx
argument was calculated with unit weights and
therefore that a linear model fit is required with error variance
estimated from the data.
When the vscale
argument is set equal to 1 this function assumes
that the xtwx
argument was calculated with weights calculated
such that a correct likelihood function can be recovered and therefore
that a generalised linear model fit is required.
Values other than NULL
or 1 for the vscale
parameter may not be
what you think. Do not use other values unless you are absolutely sure that you understand
what are doing. See the manuscript for details.
The fitted model, as returned by calling
lm.moments2
or est.moments2
.
This is a list with slots for the effect size estimates, standard errors, and
a precision matrix.
Toby Johnson Toby.x.Johnson@gsk.com
1 2 3 4 5 6  data(mthfrex)
xtx < make.moments2(mthfr.params, c("SBP", "DBP", "SexC", "Age"), mthfrex)
allsnps < paste(mthfr.params$snp, mthfr.params$coded.allele, sep = "_")
myfit < stepup.moments2(xtx, "SBP", allsnps, c("ONE", "SexC", "Age"))
## much faster than stepAIC but only steps to bigger models
cbind(beta = myfit$betahat, se = myfit$se, t = myfit$beta/myfit$se)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.