xgbp | R Documentation |
The package's main function, xgbp
poststratify a survey response from a sample
using Extreme Gradient Boosting (XGB). Dependent variables can be both binomial
or multinomial and resulting estimates can be aggregated by the full sample or
by any group used in the estimation.
xgbp( survey, census, census_count, ..., dep_var = NULL, seed = 44, tune = FALSE, params = NULL, nrounds = 80, nrounds_final = 500, n_iter = 25, nthread = 1, verbose = TRUE )
survey |
A survey sample containing the variables to use in the poststratification.
Must be a |
census |
Census data to use in the poststratification. Must be a |
census_count |
|
... |
Individual and group level covariates used in the poststratification. All
variables must be included in the |
dep_var |
Dependent variable. Must be |
seed |
A seed for replication. Defaults to |
tune |
Should the XGBP tune the parameters with randomized grid search? Defaults to |
params |
A list of parameters to be passed to xgboost function |
nrounds |
Number of trees (rounds) used in to train the model. Defaults to |
nrounds_final |
Number of trees (rounds) used in to train the final model. Defaults to |
n_iter |
When |
nthread |
Number of htreads used in the computation. Defaults to |
verbose |
Should the function report messages along the estimation? Defaults to |
A list of class xgbp
with the following items
estimates
– A tibble
containing raw estimates by strata
model
– The trained xgboost
model
data
– GBP datamatrix used to train the model
nrounds
– Number of rounds used to train the model
nrounds_final
– Number of rounds used to train the final model
census
– Census data used to poststratify results
census_count
– Variable in the census
object indicanting the raw number
or proportion of individuals in a given stratum
covars_matrix
– GBP matrix with covars used to train the model
dep_var
– Dependent variable (target)
seed
– Seed used to reproduce results
## Not run: # General use case ps <- xgbp(survey, census, var1, var2, dep_var = Y) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.