To obtain modified response values with the variation removed from the conditioned variable in a partial redundancy analysis (PRA) in R, you can use the predict()
function on the PRA model object, specifying type = "response"
and remove.conditioned = TRUE
. The predict()
function creates predicted values for the response variable based on the values of the explanatory variables after removing the variation due to the conditioned variable.
Here's an example code snippet:
main.r305 chars6 lines
In this example, we are using the pra()
function from the dismo
package to build a PRA model on the BIOMOD_Formate
dataset. The dependent variable is weight
, and the independent variables are nine bioclimatic variables represented by bio1
through bio9
. The conditioned variable is alt
.
We then use the predict()
function to create predicted values for the response variable weight
. The newdata
argument specifies that the model should use the original dataset, but we could also use a new dataset with different values for the explanatory variables. The type
argument specifies that we want response
values, and remove.conditioned
argument is set to TRUE
, to remove the variation due to the conditioned variable.
The resulting pra_predict
object contains the modified response values with the variation due to the conditioned variable removed.
gistlibby LogSnag