selec_bestsub_stepwise: conducts best subset model selection, permutation test and...

Description Usage Arguments Details Value Author(s) Examples

View source: R/contselec-package8.R

Description

This function conducts best subset model selection, permutation tests and stepwise model selection. Whether explanatory variables in the best model have statistically strong effect on the explained variable is examined.

Usage

1
2
3
4
selec_bestsub_stepwise(data0, data1, group, pos_x = NULL, pos_y = NULL,
  edge_param_number = 3, repeatn = 100, family = "glmm_poisson",
  check_spa_cor = FALSE, target = "", use_pforeach = TRUE,
  perm = TRUE, nrep = 10000)

Arguments

data0

data.frame : uncontracted data

data1

data.frame : constracted data

group

(list(gid,gid_data1,ngid,vname1_orig,vname0_orig)) : information about contraction of "data0" into "data1".

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".

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.

target

character : arbitrary name for explained variable "y".

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.

Details

Details.

Value

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);

Author(s)

Hiroshi C. Ito

Examples

 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)];
con=contract(data,edge_cor=0.9,edge_explain=0.6,target="Horsepower");
data1=con$data1;
for(i in 2:ncol(data1))data1[,i]=(data1[,i]-min(data1[,i]))/(max(data1[,i])-min(data1[,i]));

res=selec_bestsub_stepwise(con$data0,data1,con$group,
edge_param_number=3,repeatn=50,family="gaussian",
target=con$target, use_pforeach=FALSE,perm=TRUE);

print(res);
summary(res);

yorickuser/contselec documentation built on July 25, 2021, 8:14 a.m.