selec_bestsub: best-subset model selection

Description Usage Arguments Details Value Author(s) Examples

View source: R/contselec-package8.R

Description

This function conducts best-subset model selection

Usage

1
2
3
4
selec_bestsub(data0, data1, group, pos_x = NULL, pos_y = NULL,
  edge_param_number = 3, repeatn = 100, family,
  check_spa_cor = FALSE, target = "", use_pforeach = TRUE,
  perm = TRUE, daic = 2, check_spa_cor_nmodel = 50, 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 "data0".

pos_y

array of numeric : y-coordinates of spatial position for each sampled data in "data0".

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 meaningfur only when parallel proccessing is conducted by library "pforeach").

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.

perm

TRUE/FALSE : if TRUE, permutation tests for explained variables are conducted.

daic

numeric : models with Delta-AIC no more than "daic" are examined. Default value is 2.0.

nrep

integer : number of resampling in the permutation test.

Details

Details.

Value

list(result=result,bestmodels=aa,bestmodel=bestmodel, n_model=n_model,n_model_total=n_model_total)

Author(s)

Hiroshi C. Ito

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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(con$data0,data1,con$group,edge_param_number=3,repeatn=50,family="gaussian",target=con$target, use_pforeach=FALSE,perm=TRUE,daic=2.0);

print(res$result);

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