Description Usage Arguments Value See Also Examples
Fitting a spatio-temporal Bayesian model. This function is a wrapper for spT.Gibbs. For details on the fitting procedure see spT.Gibbs. This function makes it very esay to use spT.Gibbs.
1 2 3 |
data |
Modelling data.frame which contains information about the covariables and the target variable |
model |
the spatio-temporal models to be fitted, current choices are: "GP", "truncatedGP", "AR", "GPP", and "truncatedGPP", with the first one as the default. |
knots_method |
Only used if the model choice is GPP" or "truncatedGPP",
knots_method specifies the distribution method of the knots. Default is a
random distribution with respect to the location of the sensor. With
|
training_set |
an object generated by get_test_and_training_set, if those an object is delivered, the data argument will be reduced to the in training_set specified training sensors. |
knots_plot |
Should be knots be plotted, Boolean, with FALSE as default |
knots |
matrix of knots locations |
knots_seed |
Random seed for the knots sampling |
knots_count |
How much knots should be used? |
... |
additional arguments for spT.Gibbs |
An object of the class spT, see spT.Gibbs for more details
spT.Gibbs, spT.initials, spT.geodist, fit_subintervalls, predict.stAirPol.model, predict_split
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | data("mini_dataset")
#' remove outliers
mini_dataset <- clean_model_data(mini_dataset)
#' simple formula
formula <- value ~ rainhist + windhist + trafficvol
#' fit three kind of models and compair the PMCC
model.gp <- fit_sp_model(data = mini_dataset, formula = formula, model = 'GP')
model.ar <- fit_sp_model(data = mini_dataset, formula = formula, model = 'AR')
model.gpp <- fit_sp_model(data = mini_dataset, formula = formula, model = 'GPP')
print(model.gp$PMCC)
print(model.ar$PMCC)
print(model.gpp$PMCC)
#' different options for GPP model
model.gpp <- fit_sp_model(data = mini_dataset, formula = formula, model = 'GPP',
knots_method = 'random', knots_plot = TRUE,
knots_count = 20, knots_seed = 2202)
#' prioris
prio <- spT.priors(model = "GPP",
inv.var.prior = Gamm(0.5, 1),
beta.prior = Norm(0, 10^2)
)
model.gpp <- fit_sp_model(data = mini_dataset, formula = formula, model = 'GPP',
priors = prio)
#' see ?spTimer::spT.Gibbs for more options like scale.transform, spatial.decay
plot(model.gpp) #' trace plot of the MCMC-Iterations
summary(model.gpp) #' summary
#' perform the modelfit only on a trainingsset with 75% of the values
training_set <- get_test_and_training_set(mini_dataset, sampel_size = 0.75,
random.seed = 220292)
model.gp <- fit_sp_model(data = mini_dataset, formula = formula,
model = 'GP', training_set = training_set)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.