Package My.stepwise. June 29, 2017

Similar documents
Package SimSCRPiecewise

Package CPE. R topics documented: February 19, 2015

Package MultisiteMediation

Package TwoStepCLogit

Package HIMA. November 8, 2017

Package horseshoe. November 8, 2016

Regression Model Building

Package penmsm. R topics documented: February 20, Type Package

Package gwqs. R topics documented: May 7, Type Package. Title Generalized Weighted Quantile Sum Regression. Version 1.1.0

Package covtest. R topics documented:

Package severity. February 20, 2015

Package idmtpreg. February 27, 2018

Package reinforcedpred

Package EnergyOnlineCPM

Package esreg. August 22, 2017

Package polypoly. R topics documented: May 27, 2017

Package effectfusion

Package sscor. January 28, 2016

Package cartogram. June 21, 2018

Package gtheory. October 30, 2016

Package EMVS. April 24, 2018

Package HMMcopula. December 1, 2018

Package stability. R topics documented: August 23, Type Package

Package TSF. July 15, 2017

Package rgabriel. February 20, 2015

Package flexcwm. R topics documented: July 2, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.1.

Package comparec. R topics documented: February 19, Type Package

Package SK. May 16, 2018

Package icmm. October 12, 2017

Package elhmc. R topics documented: July 4, Type Package

Package causalweight

Package MPkn. May 7, 2018

Package SPreFuGED. July 29, 2016

Package OGI. December 20, 2017

Package RZigZag. April 30, 2018

Package flexcwm. R topics documented: July 11, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.0.

Package hds. December 31, 2016

Package JointModel. R topics documented: June 9, Title Semiparametric Joint Models for Longitudinal and Counting Processes Version 1.

Package msu. September 30, 2017

Package gma. September 19, 2017

Package threeboost. February 20, 2015

Package invgamma. May 7, 2017

Package BayesNI. February 19, 2015

Package Tcomp. June 6, 2018

Package scpdsi. November 18, 2018

Multivariable Fractional Polynomials

Package jmcm. November 25, 2017

Multivariable Fractional Polynomials

Package robustrao. August 14, 2017

Checking model assumptions with regression diagnostics

Package scio. February 20, 2015

Package RootsExtremaInflections

Package metafuse. October 17, 2016

Package bigtime. November 9, 2017

Package CoxRidge. February 27, 2015

Dr. Maddah ENMG 617 EM Statistics 11/28/12. Multiple Regression (3) (Chapter 15, Hines)

Package FinCovRegularization

Package mctest. February 26, 2018

Package CovSel. September 25, 2013

Package bivariate. December 10, 2018

Package netdep. July 10, 2018

Package SpatialVS. R topics documented: November 10, Title Spatial Variable Selection Version 1.1

Package InferenceSMR

Package survidinri. February 20, 2015

Package shrink. August 29, 2013

Package BGGE. August 10, 2018

Package darts. February 19, 2015

Package BNN. February 2, 2018

Package threg. August 10, 2015

Multiple linear regression S6

Package sbgcop. May 29, 2018

Package riv. R topics documented: May 24, Title Robust Instrumental Variables Estimator. Version Date

Package MiRKATS. May 30, 2016

Package ADPF. September 13, 2017

Package drgee. November 8, 2016

Package LIStest. February 19, 2015

Package anoint. July 19, 2015

Package factorqr. R topics documented: February 19, 2015

Package tspi. August 7, 2017

Package ShrinkCovMat

Package noncompliance

Package clogitboost. R topics documented: December 21, 2015

Package multivariance

holding all other predictors constant

Package matrixnormal

Package BayesTreePrior

Package r2glmm. August 5, 2017

Package RATest. November 30, Type Package Title Randomization Tests

Package KMgene. November 22, 2017

Package xdcclarge. R topics documented: July 12, Type Package

Package NlinTS. September 10, 2018

Package aspi. R topics documented: September 20, 2016

Package MicroMacroMultilevel

Package covsep. May 6, 2018

Package IUPS. February 19, 2015

Package ICGOR. January 13, 2017

Package zic. August 22, 2017

Package weightquant. R topics documented: December 30, Type Package

Package RSwissMaps. October 3, 2017

Package metansue. July 11, 2018

Transcription:

Type Package Package My.stepwise June 29, 2017 Title Stepwise Variable Selection Procedures for Regression Analysis Version 0.1.0 Author International-Harvard Statistical Consulting Company <nhsc2010@hotmail.com> Maintainer Fu-Chang Hu <fuchang.hu@gmail.com> Description The stepwise variable selection procedure (with iterations between the 'forward' and 'backward' steps) can be used to obtain the best candidate final regression model in regression analysis. All the relevant covariates are put on the 'variable list' to be selected. The significance levels for entry (SLE) and for stay (SLS) are usually set to 0.15 (or larger) for being conservative. Then, with the aid of substantive knowledge, the best candidate final regression model is identified manually by dropping the covariates with p value > 0.05 one at a time until all regression coefficients are significantly different from 0 at the chosen alpha level of 0.05. License GPL (>= 3) Encoding UTF-8 LazyData True Depends R (>= 3.3.3) Imports car, lmtest, survival, stats RoxygenNote 6.0.1 NeedsCompilation no Repository CRAN Date/Publication 2017-06-29 09:13:47 UTC R topics documented: My.stepwise.coxph..................................... 2 My.stepwise.glm...................................... 4 My.stepwise.lm....................................... 5 Index 8 1

2 My.stepwise.coxph My.stepwise.coxph Stepwise Variable Selection Procedure for Cox s Proportional Hazards Model and Cox s Model Description Usage This stepwise variable selection procedure (with iterations between the forward and backward steps) can be applied to obtain the best candidate final Cox s proportional hazards model or Cox s proportional hazards model with time-dependent covariates (called the Cox s model). My.stepwise.coxph(Time = NULL, T1 = NULL, T2 = NULL, Status = NULL, variable.list, in.variable = "NULL", data, sle = 0.15, sls = 0.15, vif.threshold = 999) Arguments Time T1 T2 Status variable.list in.variable data sle sls vif.threshold The Time (time to an event) for the sepcified Cox s proportional hazards model as in coxph(). The T1 (Start) of the long-form data for the sepcified Cox s model as in coxph(). The T2 (Stop) of the long-form data for the sepcified Cox s model as in coxph(). The Status (event indicator) for the sepcified Cox s proportional hazards model as in coxph(). A list of covariates to be selected. A list of covariate(s) to be always included in the regression model. The data to be analyzed. The chosen significance level for entry (SLE). The chosen significance level for stay (SLS). The chosen threshold value of variance inflating factor (VIF). Details The goal of regression analysis is to find one or a few parsimonious regression models that fit the observed data well for effect estimation and/or outcome prediction. To ensure a good quality of analysis, the model-fitting techniques for (1) variable selection, (2) goodness-of-fit assessment, and (3) regression diagnostics and remedies should be used in regression analysis. The stepwise variable selection procedure (with iterations between the forward and backward steps) is one of the best ways to obtaining the best candidate final regression model. All the bivariate significant and non-significant relevant covariates and some of their interaction terms (or moderators) are put on the variable list to be selected. The significance levels for entry (SLE) and for stay (SLS) are suggested to be set at 0.15 or larger for being conservative. Then, with the aid of substantive knowledge, the best candidate final regression model is identified manually by dropping the covariates with p value > 0.05 one at a time until all regression coefficients are significantly different from 0 at

My.stepwise.coxph 3 the chosen alpha level of 0.05. Since the statistical testing at each step of the stepwise variable selection procedure is conditioning on the other covariates in the regression model, the multiple testing problem is not of concern. Any discrepancy between the results of bivariate analysis and regression analysis is likely due to the confounding effects of uncontrolled covariates in bivariate analysis or the masking effects of intermediate variables (or mediators) in regression analysis. Value A model object representing the identified "Stepwise Final Model" with the values of variance inflating factor (VIF) for all included covarites is displayed. Warning The value of variance inflating factor (VIF) is bigger than 10 in continuous covariates or VIF is bigger than 2.5 in categorical covariates indicate the occurrence of multicollinearity problem among some of the covariates in the fitted regression model. See Also My.stepwise.lm My.stepwise.glm Examples ## Not run: The data 'lung' is available in the 'survival' package. ## End(Not run) if (requirenamespace("survival", quietly = TRUE)) { lung <- survival::lung } names(lung) dim(lung) my.data <- na.omit(lung) dim(my.data) head(my.data) my.data$status1 <- ifelse(my.data$status==2,1,0) my.variable.list <- c("inst", "age", "sex", "ph.ecog", "ph.karno", "pat.karno") My.stepwise.coxph(Time = "time", Status = "status1", variable.list = my.variable.list, in.variable = c("meal.cal", "wt.loss"), data = my.data) my.variable.list <- c("inst", "age", "sex", "ph.ecog", "ph.karno", "pat.karno", "meal.cal", "wt.loss") My.stepwise.coxph(Time = "time", Status = "status1", variable.list = my.variable.list, data = my.data, sle = 0.25, sls = 0.25)

4 My.stepwise.glm My.stepwise.glm Stepwise Variable Selection Procedure for Generalized Linear Models Description This stepwise variable selection procedure (with iterations between the forward and backward steps) can be applied to obtain the best candidate final generalized linear model. Usage My.stepwise.glm(Y, variable.list, in.variable = "NULL", data, sle = 0.15, sls = 0.15, myfamily, myoffset = "NULL") Arguments Y variable.list in.variable data sle sls myfamily myoffset The response variable. A list of covariates to be selected. A list of covariate(s) to be always included in the regression model. The data to be analyzed. The chosen significance level for entry (SLE). The chosen significance level for stay (SLS). The family for the sepcified generalized linear model as in glm(). The offset for the sepcified generalized linear model as in glm(). Details The goal of regression analysis is to find one or a few parsimonious regression models that fit the observed data well for effect estimation and/or outcome prediction. To ensure a good quality of analysis, the model-fitting techniques for (1) variable selection, (2) goodness-of-fit assessment, and (3) regression diagnostics and remedies should be used in regression analysis. The stepwise variable selection procedure (with iterations between the forward and backward steps) is one of the best ways to obtaining the best candidate final regression model. All the bivariate significant and non-significant relevant covariates and some of their interaction terms (or moderators) are put on the variable list to be selected. The significance levels for entry (SLE) and for stay (SLS) are suggested to be set at 0.15 or larger for being conservative. Then, with the aid of substantive knowledge, the best candidate final regression model is identified manually by dropping the covariates with p value > 0.05 one at a time until all regression coefficients are significantly different from 0 at the chosen alpha level of 0.05. Since the statistical testing at each step of the stepwise variable selection procedure is conditioning on the other covariates in the regression model, the multiple testing problem is not of concern. Any discrepancy between the results of bivariate analysis and regression analysis is likely due to the confounding effects of uncontrolled covariates in bivariate analysis or the masking effects of intermediate variables (or mediators) in regression analysis.

My.stepwise.lm 5 Value A model object representing the identified "Stepwise Final Model" with the values of variance inflating factor (VIF) for all included covarites is displayed. Warning The value of variance inflating factor (VIF) is bigger than 10 in continuous covariates or VIF is bigger than 2.5 in categorical covariates indicate the occurrence of multicollinearity problem among some of the covariates in the fitted regression model. See Also My.stepwise.lm My.stepwise.coxph Examples data("iris") names(iris) my.data <- iris[51:150, ] my.data$width <- (my.data$sepal.width + my.data$petal.width)/2 names(my.data) dim(my.data) my.data$species1 <- ifelse(my.data$species == "virginica", 1, 0) my.variable.list <- c("sepal.length", "Petal.Length") My.stepwise.glm(Y = "Species1", variable.list = my.variable.list, in.variable = c("width"), data = my.data, myfamily = "binomial") my.variable.list <- c("sepal.length", "Sepal.Width", "Width") My.stepwise.glm(Y = "Species1", variable.list = my.variable.list, data = my.data, sle = 0.25, sls = 0.25, myfamily = "binomial") My.stepwise.lm Stepwise Variable Selection Procedure for Linear Regression Model Description This stepwise variable selection procedure (with iterations between the forward and backward steps) can be applied to obtain the best candidate final linear regression model. Usage My.stepwise.lm(Y, variable.list, in.variable = "NULL", data, sle = 0.15, sls = 0.15)

6 My.stepwise.lm Arguments Y variable.list in.variable data sle sls The response variable. A list of covariates to be selected. A list of covariate(s) to be always included in the regression model. The data to be analyzed. The chosen significance level for entry (SLE). The chosen significance level for stay (SLS). Details The goal of regression analysis is to find one or a few parsimonious regression models that fit the observed data well for effect estimation and/or outcome prediction. To ensure a good quality of analysis, the model-fitting techniques for (1) variable selection, (2) goodness-of-fit assessment, and (3) regression diagnostics and remedies should be used in regression analysis. The stepwise variable selection procedure (with iterations between the forward and backward steps) is one of the best ways to obtaining the best candidate final regression model. All the bivariate significant and non-significant relevant covariates and some of their interaction terms (or moderators) are put on the variable list to be selected. The significance levels for entry (SLE) and for stay (SLS) are suggested to be set at 0.15 or larger for being conservative. Then, with the aid of substantive knowledge, the best candidate final regression model is identified manually by dropping the covariates with p value > 0.05 one at a time until all regression coefficients are significantly different from 0 at the chosen alpha level of 0.05. Since the statistical testing at each step of the stepwise variable selection procedure is conditioning on the other covariates in the regression model, the multiple testing problem is not of concern. Any discrepancy between the results of bivariate analysis and regression analysis is likely due to the confounding effects of uncontrolled covariates in bivariate analysis or the masking effects of intermediate variables (or mediators) in regression analysis. Value A model object representing the identified "Stepwise Final Model" with the values of variance inflating factor (VIF) for all included covarites is displayed. Warning The value of variance inflating factor (VIF) is bigger than 10 in continuous covariates or VIF is bigger than 2.5 in categorical covariates indicate the occurrence of multicollinearity problem among some of the covariates in the fitted regression model. See Also My.stepwise.glm My.stepwise.coxph

My.stepwise.lm 7 Examples data("lifecyclesavings") names(lifecyclesavings) dim(lifecyclesavings) my.variable.list <- c("pop15", "pop75", "dpi") My.stepwise.lm(Y = "sr", variable.list = my.variable.list, in.variable = c("ddpi"), data = LifeCycleSavings) my.variable.list <- c("pop15", "pop75", "dpi", "ddpi") My.stepwise.lm(Y = "sr", variable.list = my.variable.list, data = LifeCycleSavings, sle = 0.25, sls = 0.25)

Index My.stepwise.coxph, 2, 5, 6 My.stepwise.glm, 3, 4, 6 My.stepwise.lm, 3, 5, 5 8