parSpModel: Generation of Spatiotemporal Models by Bootstrap Aggregating

Description Usage Arguments Details Value Author(s) References Examples

View source: R/parSpModel.R

Description

Generation of multiple models using bootstrap aggregating, supporting multi-cores based parallel computing.

Usage

1
2
parSpModel(tSet,bnd,fS,tidF="tid",tids, c=1,
     nM=30,mPath,idF="siteid",dateF="date",obsF="pm25")

Arguments

tSet

Dataframe of the training dataset, including the measurements of the target variable and covariates.

bnd

BND object used in saptial effect modeling (BayesX)

fS

Formula string, like that used in BayesX

tidF

time id (ensemble models for each time point)

tids

all the time ids for which multiple models will be trained.

c

CPU core number

nM

Number of ensemble models for each time point.

mPath

Path where the models will be saved.

idF

Unique location name

dateF

Time id

obsF

Target variable name

Details

Batch training of the models using the multi-cores based parallel computing

Value

The model will be saved into the assigned path.

Author(s)

Lianfa Li lspatial@gmail.com

References

Breiman, L., 1996. Bagging Predictors. Machine Learning 24, 123-140. Lianfa Li et al, 2017, Constrained Mixed-Effect Models with Ensemble Learning for Prediction of Nitrogen Oxides Concentrations at High Spatiotemporal Resolution, ES & T, DOI: 10.1021/acs.est.7b01864

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Example the PM2.5 data for Shandong

dPath=tempdir()
mPath=paste(dPath,"/models",sep="")
unlink(mPath,recursive = TRUE)
dir.create(mPath)

data("trainsample","bnd")

aform=paste0('logpm25 ~sx(rid,bs ="mrf",map =bnd)+sx(monthAv,bs="rw2")')
aform=paste0(aform,'+sx(ndvi,bs="rw2")+sx(aod,bs="rw2")+sx(wnd_avg,bs="rw2")')

formulaStrs=c(aform)

trainsample$tid=as.numeric(strftime(trainsample$date, format = "%j"))
trainsample$logpm25=log(trainsample$pm25)
tids=c(91)

parSpModel(trainsample,bnd,formulaStrs,tidF="tid",
   tids,c=2,nM=3,mPath,idF="siteid",dateF="date",obsF="pm25")

lspatial/sptemUS documentation built on May 29, 2019, 3:42 a.m.