mbm: Create an mbm model

Description Usage Arguments Details Value References

View source: R/mbm.r

Description

Create an mbm model

Usage

1
2
3
4
mbm(y, x, y_name = "beta", link = c("identity", "probit"),
  likelihood = c("gaussian"), lengthscale = NULL, sparse = FALSE,
  force_increasing = FALSE, sparse_inducing = 10, sparse_batch = 10,
  sparse_iter = 10000, exact_thresh = 100, verbose = FALSE)

Arguments

y

Square dissimilarity or distance matrix, can be complete or lower triangular only. Row and column names are required and must match the site names in the rows of x.

x

Matrix giving a series of covariates (in columns) for all sites (in rows). Row names are required. All variables will be included in the model.

y_name

A name to give to the y variable

link

Link function to use

likelihood

Likelihood function to use

lengthscale

Either NULL (in which case all lengthscales will be optimized) or a numeric vector of length ncol(x)+1. If a vector, the first entry corresponds to environmental distance, and entries i = 1 + (1:n) correspond to the variable in x[,i]. Values must be NULL or positive numbers; if NULL, the corresponding lengthscale will be set via optimization, otherwise it will be fixed to the value given.

sparse

Should we use the stochastic variational GP (see 'details').

force_increasing

Boolean; if true, beta diversity will be constrained to increase with environmental distance

sparse_inducing

Number of inducing inputs to use if 'sparse = TRUE'

sparse_batch

Batch size to use if 'sparse = TRUE'

sparse_iter

Maximum number of optimizer iterations if 'sparse = TRUE'

exact_thresh

integer; threshold at which mbm will refuse to run an exact gp.

verbose

Should messages during model fitting be printed?

Details

For larger datasets (more than ~100 sites), it is recommended to use 'sparse=TRUE'. This will use a sparse approximation to the default method, following the stochastical variational GP (Hensman et al 2013). Note that if a link function is selected, it will be applied as a transformation of the y data–i.e., for link function L() we fit a SVGP to describe the expectation E(L(y))–rather than as a true link function– fitting L(E(y))–as is done when 'svgp=FALSE'. This is due to a limitation in the underlying GP library.

Value

An S3 object of class mbm, containing the following components: * 'x': the original (untransformed) site by covariate matrix * 'y': the original (untransformed) site by site diversity data * 'covariates': Transformed x-variables supplied to mbm * 'response': Transformed response variable; this is the data supplied to mbm * 'covar_sites': Site names to match the covariate matrix * 'y_transform': transformation applied to y-data before modelling * 'y_rev_transform': reverse transformation to get y-data back on the original scale * 'link': a character string identifying the link function * 'inv_link': inverse of the link function * 'pyobj': A list of python objects used by the model; this is not meant for user interaction

References

Hensman J, Fusi N, and Lawrence ND. 2013. Gaussian Processes for Big Data. In: In Proceedings of the 29th Conference on Uncertainty in Artificial Intelligence.


mtalluto/mbmtools documentation built on Aug. 13, 2019, 9:44 a.m.