predict.bruSDM {PointedSDMs} | R Documentation |
Generic predict function for bru_SDM
objects.
Description
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.
Usage
## 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 |
data |
Data containing points of the map with which to predict on. May be |
formula |
Formula to predict. May be |
mesh |
An |
mask |
A mask of the study background. Defaults to |
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 |
intercepts |
Logical: include intercept terms in prediction. Defaults to |
datasets |
Names of the datasets to include intercept and spatial term. |
species |
Names of the species to predict. Default of |
marks |
Names of the marks to include intercept and spatial term. |
biasfield |
Logical include bias field in prediction. Defaults to |
biasnames |
Names of the datasets to include bias term. Defaults to |
predictor |
Should all terms (except the bias terms) included in the linear predictor be used in the predictions. Defaults to |
fun |
Function used to predict. Set to |
format |
Class of the data for which to predict on. Must be one of |
... |
Additional arguments used by the inlabru |
bias |
Logical include bias field in prediction. Defaults to |
Details
Predict for bru_sdm
Predict for modISDM
Predict for modMarks
Predict for modSpecies
Value
A list of inlabru predict objects.
A list of inlabru predict objects.
A list of inlabru predict objects.
A list of inlabru predict objects.
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)