Addz {NCSampling} | R Documentation |
Addz
Description
Add variable/s to the population file which are good predictors of the variables/s of interest
Usage
Addz(popfile, training, yvars, xvars, pool)
Arguments
popfile |
dataframe containing population data - as a minimum there must be columns named 'PID' (plot identifier), 'Strata' and 'plot_type'. |
training |
dataframe containing training data. Must contain auxiliary variables and variable/s of interest. |
yvars |
vector containing the name of each variable of interest (dependent variable). |
xvars |
vector containing the names of the auxiliary variables. |
pool |
logical value - should the training data be pooled across strata prior to fitting the regression model? |
Details
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.
Value
A list with components:-
popfile |
population file - data frame, as above, with predictor variable/s added to the file |
r.sqared |
dataframe containing the R-squared values obtained from the random forest regression/s |
Author(s)
G. Melville
References
Random forest regression is performed using the randomForest package.
See Also
DesVar, randomForest
.
Examples
## Addz(popfile, training, yvars, xvars)