Add variable/s to the population file which are good predictors of the variables/s of interest
Addz(popfile, training, yvars, xvars, pool)
dataframe containing population data - as a minimum there must be columns named 'PID' (plot identifier), 'Strata' and 'plot_type'.
dataframe containing training data. Must contain auxiliary variables and variable/s of interest.
vector containing the name of each variable of interest (dependent variable).
vector containing the names of the auxiliary variables.
logical value - should the training data be pooled across strata prior to fitting the regression model?
A list with components:-
population file - data frame, as above, with predictor variable/s added to the file
dataframe containing the R-squared values obtained from the random forest regression/s
The predictor variable for the each variable of interest (dependent variable) is obtained by performing random forest regression on the training data using the designated auxiliary variables. The training data can be pooled across strata (pool=T), or fitted separately within each strata (the default). Not normally called directly.
Random forest regression is performed using the randomForest package.
DesVar, randomForest
.
## Addz(popfile, training, yvars, xvars)
Run the code above in your browser using DataLab