barp | R Documentation |
This function uses Bayesian Additive Regression Trees (BART) to extrapolate survey data to a level of geographic aggregation at which the original survey was not sampled to be representative of.
barp( y, x, dat, census, geo.unit, algorithm = "BARP", proportion = "None", cred_int = c(0.025, 0.975), BSSD = F, nsims = 200, setSeed = NULL, ... )
y |
Outcome of interest. Should be a character of the column name containing the variable of interest. |
x |
Prognostic covariates. Should be a vector of column names corresponding to the covariates used to predict the outcome variable of interest. |
dat |
Survey data containing the x and y column names. |
census |
Census data containing the x column names. If the user provides raw census data, BARP will calculate proportions for each unique bin of x covariates. Otherwise, the researcher must calculate bin proportions and indicate the column name that contains the proportions, either as percentages or as raw counts. |
geo.unit |
The column name corresponding to the unit at which outcomes should be aggregated. |
algorithm |
Algorithm for predicting opinions. Can be any algorithm(s) included in the |
proportion |
The column name corresponding to the proportions for covariate bins in the Census data. If left to the default |
cred_int |
A vector giving the lower and upper bounds on the credible interval for the predictions. |
BSSD |
Calculate bootstrapped standard deviation. Defaults to |
nsims |
The number of bootstrap simulations. |
setSeed |
Seed to control random number generation. |
... |
Additional arguments to be passed to bartMachine or SuperLearner. |
Returns an object of class “BARP”, containing a list of the following components:
pred.opn |
A |
trees |
A |
risk |
A |
bartMachine
which this program uses to implement Bayesian Additive Regression Trees.
SuperLearner
which this program uses to implement alternative regularizers.
data("gaymar") barp <- barp(y = "supp_gaymar", x = c("pvote","religcon","age","educ","gXr","stateid","region"), dat = svy, census = census06, geo.unit = "stateid", proportion = "n", cred_int = c(0.025,0.975))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.