Description Usage Arguments Details Value Author(s) Examples
View source: R/contselec-package8.R
This function contracts explanatory variables and conduct best subset model selection, permutation test and stepwise model selection.
1 2 3 4 |
data00 |
data.frame : an explained variable and explanatory variables. The explained variable is specified by "target". |
pos_x |
array of numeric : x-coordinates of spatial position for each sampled data in "data00". |
pos_y |
array of numeric : y-coordinates of spatial position for each sampled data in "data00". |
target |
integer or character : spefifies explained variables by its column id (integer) or column name (character). |
edge_cor |
real number : threshold for grouping; variables of correlation no less than this threshold are grouped together. |
edge_explain |
real number : threshold for the variance ratio to be explained, based on which the number of principal components "np" to represent the contracted group is determined. |
edge_param_number |
real number: this parameter constrains the number of explanatory variables in the subset model selection and stepwise model selection, so that [sample size]/[number of free parameter] >= "edge_param_number". |
repeatn |
integer : the number of model evaluations proccessed as a single job for each CPU core (This parameter is meaningful only when "use_pforeach" is TRUE). |
family |
character : error distribution. Possible choices are "glmm_poisson", "poisson","gaussian". |
check_spa_cor |
TRUE/FALSE : if TRUE, the best model with residuals significantly correlated with c(pos_x, pos_y) are removed repeatedly until the correlation becomes non-significant. |
use_pforeach |
TRUE/FALSE : if TRUE, pforeach is used instead of foreach in best subset selection and permutation tests (when "perm" is TRUE). |
perm |
TRUE/FALSE : if TRUE, permutation tests for explained variables are conducted. |
nrep |
integer : number of resampling in the permutation test. |
Spatial correlation of residuals of each fitted model can also be examimed.
list(target=target, result=result, data0=data0, data1=data1, group=group, family=family, bestmodels=res_sb$bestmodels, bestmodel_stepwise=res_ss$bestmodel, bestmodel=res_sb$bestmodel, pos_x=pos_x, pos_y=pos_y)
Hiroshi C. Ito
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(Cars93, package = "MASS");
data=Cars93;
data=data[complete.cases(data),];
data=data[,sapply(data[1,],is.numeric)];
res=cont_selec(data,target="Horsepower",edge_cor=0.9,edge_explain=0.6,
edge_param_number=3,family="gaussian",use_pforeach=FALSE);
plot_each_effect(res)
plot_combined_effect(res,sign_effect=-1)
plot_combined_effect(res,sign_effect=1)
print(res);
summary(res);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.