R/forward.sel.R
forward.sel.Rd
Performs a forward selection by permutation of residuals under reduced model. Y can be multivariate.
forward.sel(
Y,
X,
K = nrow(X) - 1,
R2thresh = 0.99,
adjR2thresh = 0.99,
nperm = 999,
R2more = 0.001,
alpha = 0.05,
Xscale = TRUE,
Ycenter = TRUE,
Yscale = FALSE,
verbose = TRUE
)
Response data matrix with n rows and m columns containing quantitative variables
Explanatory data matrix with n rows and p columns containing quantitative variables
Maximum number of variables to be selected. The default is one minus the number of rows
Stop the forward selection procedure if the R-square of the model exceeds the stated value. This parameter can vary from 0.001 to 1
Stop the forward selection procedure if the adjusted R-square of the model exceeds the stated value. This parameter can take any value (positive or negative) smaller than 1
The number of permutation to be used.The default setting is 999 permutation.
Stop the forward selection procedure if the difference in model R-square with the previous step is lower than R2more. The default setting is 0.001
Significance level. Stop the forward selection procedure if the p-value of a variable is higher than alpha. The default is 0.05 is TRUE
Standardize the variables in table X to variance 1. The default setting is TRUE
Center the variables in table Y. The default setting is TRUE
Standardize the variables in table Y to variance 1. The default setting is FALSE.
If 'TRUE' more diagnostics are printed. The default setting is TRUE
A dataframe with:
The names of the variables
The order of the selection of the variables
The R2 of the variable selected
The cumulative R2 of the variables selected
The cumulative adjusted R2 of the variables selected
The F statistic
The P-value statistic
The forward selection will stop when either K, R2tresh, adjR2tresh, alpha and R2more has its parameter reached.
Not yet implemented for CCA (weighted regression) and with covariables.
Canoco manual p.49
x <- matrix(rnorm(30),10,3)
y <- matrix(rnorm(50),10,5)
forward.sel(y,x,nperm=99, alpha = 0.5)
#> Testing variable 1
#> Testing variable 2
#> Testing variable 3
#> Procedure stopped (alpha criteria): pvalue for variable 3 is 0.770000 (> 0.500000)
#> variables order R2 R2Cum AdjR2Cum F pvalue
#> 1 V3 3 0.1540777 0.1540777 0.04833738 1.457133 0.21
#> 2 V2 2 0.2005871 0.3546648 0.17028326 2.175783 0.06