Apply the spatial decorrelation transformation to a newdata object. This object contains explanatory variables that are transformed for prediction according to some spatial decorrelation transformation.

ssn_decorrelate_newdata(object, newdata, local, ...)

Arguments

object

An ssn_decorrelate_data() object.

newdata

A character string naming a single prediction data set (accessible via object$covariance_fit$ssn.object$preds). Note that the prediction data must be in the original SSN object used to fit the model. If omitted, missing data from the fitted model object are used via the .missing prediction set, if present. Otherwise, newdata must be supplied.

local

An optional logical or list controlling the big data approximation. If omitted, the settings in object$local are used. If local is FALSE, no big data approximation is implemented. If a list is provided, the following arguments detail the big data approximation:

  • method: The big data approximation method. If method = "all", all observations are used and size is ignored. If method = "covariance", the size data observations with the highest absolute covariance with the observation requiring prediction are used. The default is "covariance".

  • size: The number of data observations to use when method is "covariance". The default is 30.

  • parallel: If TRUE, parallel processing via the parallel package is used. The default is FALSE.

  • ncores: If parallel = TRUE, the number of cores to parallelize over. The default is the number of available cores on your machine.

When local is a list, at least one list element must be provided to initialize default arguments for the other list elements. If local is TRUE, defaults for local are chosen such that local is transformed into list(size = 30, method = "covariance", parallel = FALSE).

...

Other arguments.

Value

A list with many elements that store information about the fitted model object. Importantly, the list contains the following elements:

  • X_newdata: The original fixed effects design matrix (of explanatory variables) for the prediction data.

  • tX_newdata: The spatially decorrelated fixed effects design matrix for the prediction data.

Examples

# \donttest{
# Copy the mf04p .ssn data to a local directory and read it into R
# When modeling with your .ssn object, you will load it using the relevant
# path to the .ssn data on your machine
copy_lsn_to_temp()
temp_path <- paste0(tempdir(), "/MiddleFork04.ssn")
mf04p <- ssn_import(temp_path,
  predpts = "CapeHorn", overwrite = TRUE
)
ssn_create_distmat(mf04p, predpts = "CapeHorn", overwrite = TRUE)
transformed <- ssn_decorrelate_data(
  Summer_mn ~ ELEV_DEM, mf04p, additive = "afvArea",
  tailup_params = tailup_params("exponential", de = 1, range = 10000),
  nugget_params = nugget_params("nugget", nugget = 0.1)
)
#> Error in ssn_decorrelate_data(Summer_mn ~ ELEV_DEM, mf04p, additive = "afvArea",     tailup_params = tailup_params("exponential", de = 1, range = 10000),     nugget_params = nugget_params("nugget", nugget = 0.1)): could not find function "ssn_decorrelate_data"
new_transformed <- ssn_decorrelate_newdata(transformed, "CapeHorn")
#> Error in ssn_decorrelate_newdata(transformed, "CapeHorn"): could not find function "ssn_decorrelate_newdata"
head(new_transformed$tX_newdata)
#> Error in eval(expr, envir, enclos): object 'new_transformed' not found
# }