Predict function for the object produced by fitISDM. Should act identically to inlabru's generic predict function if wanted, but has additional arguments to help predict certain components created by the model. This is needed since intModel creates variable names which might not be directly apparent to the user.
Predict function for the object produced by fitISDM. Should act identically to inlabru's generic predict function if wanted, but has additional arguments to help predict certain components created by the model. This is needed since startISDM creates variable names which might not be directly apparent to the user.
Predict function for the object produced by fitISDM. Should act identically to inlabru's generic predict function if wanted, but has additional arguments to help predict certain components created by the model. This is needed since startMarks creates variable names which might not be directly apparent to the user.
Predict function for the object produced by fitISDM. Should act identically to inlabru's generic predict function if wanted, but has additional arguments to help predict certain components created by the model. This is needed since startSpecies creates variable names which might not be directly apparent to the user.
## S3 method for class 'bruSDM'predict( object, data =NULL, formula =NULL, mesh =NULL, mask =NULL, temporal =FALSE, covariates =NULL, spatial =FALSE, intercepts =FALSE, datasets =NULL, species =NULL, marks =NULL, biasfield =FALSE, biasnames =NULL, predictor =FALSE, fun ="linear", format ="sf",...)## S3 method for class 'modISDM'predict( object, data =NULL, formula =NULL, mesh =NULL, mask =NULL, covariates =NULL, spatial =FALSE, intercepts =FALSE, datasets =NULL, bias =FALSE, biasnames =NULL, predictor =FALSE, fun ="linear",...)## S3 method for class 'modMarks'predict( object, data =NULL, formula =NULL, mesh =NULL, mask =NULL, covariates =NULL, spatial =FALSE, intercepts =FALSE, datasets =NULL, marks =NULL, bias =FALSE, biasnames =NULL, predictor =FALSE, fun ="linear",...)## S3 method for class 'modSpecies'predict( object, data =NULL, formula =NULL, mesh =NULL, mask =NULL, covariates =NULL, spatial =FALSE, intercepts =FALSE, datasets =NULL, species, bias =FALSE, biasnames =NULL, predictor =FALSE, fun ="linear",...)
Arguments
object: A modSpecies object.
data: Data containing points of the map with which to predict on. May be NULL if one of mesh or mask is NULL.
formula: Formula to predict. May be NULL if other arguments: covariates, spatial, intercepts are not NULL.
mesh: An fm_mesh_2d object.
mask: A mask of the study background. Defaults to NULL.
temporal: Make predictions for the temporal component of the model.
covariates: Name of covariates to predict.
spatial: Logical: include spatial effects in prediction. Defaults to FALSE.
intercepts: Logical: include intercept terms in prediction. Defaults to FALSE.
datasets: Names of the datasets to include intercept and spatial term.
species: Names of the species to predict. Default of NULL results in all species being predicted.
marks: Names of the marks to include intercept and spatial term.
biasfield: Logical include bias field in prediction. Defaults to FALSE.
biasnames: Names of the datasets to include bias term. Defaults to NULL. Note: the chosen dataset needs to be run with a bias field first; this can be done using .$addBias with the object produced by startSpecies.
predictor: Should all terms (except the bias terms) included in the linear predictor be used in the predictions. Defaults to FALSE.
fun: Function used to predict. Set to 'linear' if effects on the linear scale are desired.
format: Class of the data for which to predict on. Must be one of 'sp', 'sf' or 'terra'. Defaults to 'sf'.
...: Additional arguments used by the inlabru predict function.
bias: Logical include bias field in prediction. Defaults to FALSE.
Returns
A list of inlabru predict objects.
A list of inlabru predict objects.
A list of inlabru predict objects.
A list of inlabru predict objects.
Details
Predict for bru_sdm
Predict for modISDM
Predict for modMarks
Predict for modSpecies
Examples
## Not run:if(requireNamespace('INLA')){#Get Data data("SolitaryTinamou") proj <-"+proj=longlat +ellps=WGS84" data <- SolitaryTinamou$datasets
mesh <- SolitaryTinamou$mesh
mesh$crs <- proj
#Set model up organizedData <- intModel(data, Mesh = mesh, Coordinates = c('X','Y'), Projection = proj, responsePA ='Present')##Run the model modelRun <- fitISDM(organizedData, options = list(control.inla = list(int.strategy ='eb')))#Predict spatial field on linear scale predictions <- predict(modelRun, mesh = mesh, spatial =TRUE, fun ='linear')}## End(Not run)## Not run:if(requireNamespace('INLA')){#Get Data data("SolitaryTinamou") proj <-"+proj=longlat +ellps=WGS84" data <- SolitaryTinamou$datasets
mesh <- SolitaryTinamou$mesh
mesh$crs <- proj
#Set model up organizedData <- startISDM(data, Mesh = mesh, Projection = proj, responsePA ='Present')##Run the model modelRun <- fitISDM(organizedData, options = list(control.inla = list(int.strategy ='eb')))#Predict spatial field on linear scale predictions <- predict(modelRun, mesh = mesh, spatial =TRUE, fun ='linear')}## End(Not run)## Not run:if(requireNamespace('INLA')){#Get Data data("SolitaryTinamou") proj <-"+proj=longlat +ellps=WGS84" data <- SolitaryTinamou$datasets
mesh <- SolitaryTinamou$mesh
data <- lapply(data,function(x){x$mark = runif(nrow(x));x}) mesh$crs <- proj
#Set model up organizedData <- startMarks(data, Mesh = mesh, markNames ='mark', markFamily ='gaussian', Projection = proj, responsePA ='Present')##Run the model modelRun <- fitISDM(organizedData, options = list(control.inla = list(int.strategy ='eb', diagonal =1)))#Predict spatial field on linear scale predictions <- predict(modelRun, mesh = mesh, marks ='mark', fun ='linear')}## End(Not run)## Not run:if(requireNamespace('INLA')){#Get Data data("SolitaryTinamou") proj <-"+proj=longlat +ellps=WGS84" data <- SolitaryTinamou$datasets
mesh <- SolitaryTinamou$mesh
mesh$crs <- proj
#Set model up organizedData <- startSpecies(data, Mesh = mesh, speciesName ='speciesName', Projection = proj, responsePA ='Present')##Run the model modelRun <- fitISDM(organizedData, options = list(control.inla = list(int.strategy ='eb', diagonal =1)))#Predict spatial field on linear scale predictions <- predict(modelRun, mesh = mesh, spatial =TRUE, fun ='linear')}## End(Not run)