Skip to content

Commit

Permalink
Updates to predict for single species model
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipMostert committed Apr 29, 2024
1 parent cba293a commit dedc334
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/bruSDM_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ predict.bruSDM <- function(object, data = NULL, formula = NULL, mesh = NULL,
if (is.null(datasets)) datasets <- unique(object$source)


if (!is.null(unlist(object[['species']][['speciesIn']]))) {

speciespreds <- TRUE
if (!is.null(unlist(object[['species']][['speciesIn']]))) speciespreds <- TRUE
else speciespreds <- FALSE

if (predictor) {

Expand Down Expand Up @@ -127,8 +126,6 @@ predict.bruSDM <- function(object, data = NULL, formula = NULL, mesh = NULL,
else speciesin <- species
if (!all(species %in% unique(unlist(object[['species']][['speciesIn']])))) stop('Species provided not in model.')

}
else speciespreds <- FALSE


if (is.null(object$spatCovs$covariateFormula)) {
Expand Down Expand Up @@ -362,7 +359,12 @@ predict.bruSDM <- function(object, data = NULL, formula = NULL, mesh = NULL,

}
}
else spatial_obj <- NULL
else {

spatial_obj <- NULL
marks_spatial <- NULL

}

if (predictor) formula_components <- c(row.names(object$summary.fixed), names(object$summary.random)[!names(object$summary.random) %in% paste0(object[['source']], '_biasField')])
else formula_components <- c(covariates, intercept_terms, spatial_obj, marks_spatial, marks_intercepts)
Expand Down

0 comments on commit dedc334

Please sign in to comment.