Prepare and plot response curve data for Hmsc models
Source:R/Mod_RespCurv_PrepData.R
, R/Mod_RespCurv_PlotSp.R
, R/Mod_RespCurv_PlotSpAll.R
, and 1 more
Response_curves.Rd
The RespCurv_*()
functions process and visualize response curves for Hmsc
models. They support parallel computation and optionally return processed
data. There are four functions in this group:
RespCurv_PrepData()
: Prepares response curve data for analysisRespCurv_PlotSp()
: Generates response curve plots for individual speciesRespCurv_PlotSpAll()
: Generates response curves for all species together in a single plotRespCurv_PlotSR()
: Plots response curves for species richness.
Usage
RespCurv_PrepData(
Path_Model = NULL,
N_Grid = 50,
NCores = 8,
ReturnData = FALSE,
Probabilities = c(0.025, 0.5, 0.975),
UseTF = TRUE,
TF_Environ = NULL,
TF_use_single = FALSE,
LF_NCores = NCores,
LF_Check = FALSE,
LF_Temp_Cleanup = TRUE,
LF_Commands_Only = FALSE,
Temp_Dir = "TEMP_Pred",
Temp_Cleanup = TRUE,
Verbose = TRUE
)
RespCurv_PlotSp(
ModelDir = NULL,
NCores = 20,
EnvFile = ".env",
ReturnData = FALSE
)
RespCurv_PlotSpAll(
ModelDir = NULL,
NCores = 8L,
ReturnData = FALSE,
PlottingAlpha = 0.3
)
RespCurv_PlotSR(ModelDir, Verbose = TRUE, NCores = 8L)
Arguments
- Path_Model
Character. Path to the file containing the fitted Hmsc model.
- N_Grid
Integer. Number of points along the gradient for continuous focal variables. Higher values result in smoother curves. Default: 50. See Hmsc::constructGradient for details.
- NCores
Integer. Number of CPU cores to use for parallel processing. Defaults to 8 for all functions, except for
RespCurv_PlotSp
, in which it defaults to 20.- ReturnData
Logical. If
TRUE
, the function returns processed data as an R object. Default:FALSE
.- Probabilities
Numeric vector. Quantiles to calculate in response curve predictions. Default:
c(0.025, 0.5, 0.975)
. See stats::quantile for details.- UseTF
Logical. Whether to use TensorFlow for calculations. Defaults to
TRUE
.- TF_Environ
Character. Path to the Python environment. This argument is required if
UseTF
isTRUE
under Windows. Defaults toNULL
.- TF_use_single
Logical. Whether to use single precision for the TensorFlow calculations. Defaults to
FALSE
.- LF_NCores
Integer. Number of cores to use for parallel processing of latent factor prediction. Defaults to 8L.
- LF_Check
Logical. If
TRUE
, the function checks if the output files are already created and valid. IfFALSE
, the function will only check if the files exist without checking their integrity. Default isFALSE
.- LF_Temp_Cleanup
Logical. Whether to delete temporary files in the
Temp_Dir
directory after finishing the LF predictions.- LF_Commands_Only
Logical. If
TRUE
, returns the command to run the Python script. Default isFALSE
.- Temp_Dir
Character. Path for temporary storage of intermediate files.
- Temp_Cleanup
Logical. Whether to clean up temporary files. Defaults to
TRUE
.- Verbose
Logical. Whether to print a message upon successful saving of files. Defaults to
FALSE
.- ModelDir
Character. Path to the root directory containing fitted models. The function reads data from the
RespCurv_DT
subdirectory, which is created byRespCurv_PrepData
.- EnvFile
Character. Path to the environment file containing paths to data sources. Defaults to
.env
.- PlottingAlpha
Numeric. Opacity level for response curve lines (0 = fully transparent, 1 = fully opaque). Default: 0.3.