a function to model curves using a spatio-temporal bayesian modelling using CARBayesST library

fitCARBayesST(
  datain,
  xvar,
  trait,
  k = NULL,
  graphDist,
  burnin = 500,
  n.sample = 1500,
  formulaModel,
  typeModel = "anova",
  verbose
)

Arguments

datain

input dataframe of parameters

xvar

character, time variable (ex: thermalTime)

trait

character, parameter of interest (ex: plantHeight)

k

numeric, number of nearest neighbours to be returned

graphDist

logical, display distance graph

burnin

The number of MCMC samples to discard as the burn-in period

n.sample

The number of MCMC samples to generate

formulaModel

A formula for the covariate part of the model using the syntax of the lm() function. see ST.CARanova help

typeModel

character, choice of the model, anova, linear or ar

verbose

logical FALSE by default, if TRUE display information about the progress

Value

a list with a spatio-temporal object (CARBayesST) and a dataframe of the formated data

Details

the input dataset must contain Position,Line,Ref,scenario,genotypeAlias columns. The function is not generic and needs specific columns names in the input data set. Please have a look of the struture of the data set used in the example.

See also

CARBayesST, ST.CARanova and spdep

Examples

data(plant1) library(dplyr)
#> #> Attachement du package : 'dplyr'
#> The following objects are masked from 'package:stats': #> #> filter, lag
#> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union
mydata<-filter(plant1,!is.na(plant1$thermalTime)) str(mydata)
#> 'data.frame': 45342 obs. of 14 variables: #> $ Ref : Factor w/ 1680 levels "manip1_10_10_WW",..: 131 131 131 131 131 131 131 131 131 131 ... #> $ experimentAlias: Factor w/ 1 level "manip1": 1 1 1 1 1 1 1 1 1 1 ... #> $ Day : Factor w/ 42 levels "2013-02-01","2013-02-02",..: 3 4 5 6 7 9 9 10 11 12 ... #> $ potAlias : int 1 1 1 1 1 1 1 1 1 1 ... #> $ scenario : Factor w/ 2 levels "WD","WW": 2 2 2 2 2 2 2 2 2 2 ... #> $ genotypeAlias : Factor w/ 274 levels "11430_H","A310_H",..: 165 165 165 165 165 165 165 165 165 165 ... #> $ repetition : int 1 1 1 1 1 1 1 1 1 1 ... #> $ Line : int 1 1 1 1 1 1 1 1 1 1 ... #> $ Position : int 1 1 1 1 1 1 1 1 1 1 ... #> $ thermalTime : num 1.29 2.65 3.98 5.32 6.66 ... #> $ plantHeight : num 140 151 213 239 271 ... #> $ leafArea : num 0.018 0.019 0.0208 0.0222 0.0235 ... #> $ biovolume : num 0.253 0.62 1.201 1.68 3.396 ... #> $ Repsce : Factor w/ 15 levels "1_WD","1_WW",..: 2 2 2 2 2 2 2 2 2 2 ...
test<-fitCARBayesST(datain=mydata,xvar="thermalTime", trait="plantHeight",k=2, graphDist=TRUE,burnin=10,n.sample=110, formulaModel=as.formula(plantHeight~scenario+genotypeAlias), typeModel="anova",verbose=FALSE)
#> [1] 22.35558
#> used (Mb) gc trigger (Mb) max used (Mb) #> Ncells 3713681 198.4 6893817 368.2 3713681 198.4 #> Vcells 67183832 512.6 211775864 1615.8 67183832 512.6