In order to retrieve the response variable values from reduced variation by conditioned redundancy analysis in R, you can use the predict
function after fitting the regression model.
Assuming you have a data frame data
containing your response variable y
and your explanatory variables x1
, x2
, x3
, you can perform conditioned redundancy analysis using the rda
function from the vegan
package as follows:
main.r58 chars3 lines
Once you've fit the model, you can use the predict
function to get predicted values of the response variable for any new data:
main.r113 chars3 lines
This will give you a vector of predicted values for the response variable y
based on the new data in new_data
. You can also use the predict
function to get predicted values for the training data by omitting the newdata
argument.
gistlibby LogSnag