Description Usage Arguments Details Value Examples
This function is for a batch training models. The users can call parSpModel rather than this for training of multiple models.
1 | abatchModel(td,bnd,fS,iF,iT,tidF,tids,mPath,idF="siteid",dateF="date",obsF="obs",nM)
|
td |
Training dataset |
bnd |
Map object used in spatial effect model. For specific format, refer to BayesX |
fS |
Formular string |
iF |
Staring time id |
iT |
Ending time id |
tidF |
Time field name |
tids |
Time vector |
mPath |
The path for the models trained to be saved |
idF |
location id name |
dateF |
Date or time field name |
obsF |
observed value field name |
nM |
number of models to be trained |
This is an inner function to be called by parSpModel.
The trained models will be saved on the appointed path. No direct output for this function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #An example of PM2.5 data from Shandong
dPath=tempdir()
modelPath=paste(dPath,"/models",sep="")
unlink(modelPath,recursive = TRUE)
dir.create(modelPath)
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)
abatchModel(trainsample,bnd,formulaStrs,1,1,"tid",tids,modelPath,"siteid","date","pm25",3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.