Description Usage Arguments Details Value References Examples

It uses the model calibrated estimator introduced by Wu et al. (2001).

1 2 3 4 5 6 7 8 9 10 11 12 |

`sample_data` |
Data frame containing the sample. |

`weights` |
Vector containing the sample weights. |

`full_data` |
Data frame containing all the individuals contained in the population. |

`covariates` |
String vector specifying the common variables to use for training. |

`estimated_var` |
String specifying the variable to estimate. |

`estimate_mean` |
Boolean specifying whether the mean estimation should be returned. Otherwise, the total estimation is returned by default. |

`positive_label` |
String specifying the label to be considered positive if the estimated variable is categorical. Leave it as the default NULL otherwise. |

`algorithm` |
A string specifying which classification or regression model to use (same as caret's method). |

`proc` |
A string or vector of strings specifying if any of the data preprocessing techniques available in train function from 'caret' package should be applied to data prior to the propensity estimation. By default, its value is NULL and no preprocessing is applied. |

`...` |
Further parameters to be passed to the train function. |

Training of the models is done via the 'caret' package. The algorithm specified in `algorithm`

must match one of the names in the list of algorithms supported by 'caret'.

The population total estimation (or mean if specified by the 'estimate_mean' parameter).

Wu, C., & Sitter, R. R. (2001). *A model-calibration approach to using complete auxiliary information from survey data.* Journal of the American Statistical Association, 96(453), 185-193.

1 2 3 4 5 6 7 | ```
#Simple example
covariates = c("education_primaria", "education_secundaria",
"age", "sex", "language")
if (is.numeric(sampleNP$vote_gen))
sampleNP$vote_gen = factor(sampleNP$vote_gen, c(0, 1), c('F', 'T'))
model_calibrated(sampleNP, nrow(population) / nrow(sampleNP),
population, covariates, "vote_gen", positive_label = 'T', algorithm = 'glmnet')
``` |

```
Loading required package: lattice
Loading required package: ggplot2
[1] 4941.118
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.