prop_estimation: Estimates the population proportion

Description Usage Arguments Value Examples

View source: R/NonProbEst.R

Description

Estimates the proportion of a given class or classes for the specified variables measured in a sample given some pre-calculated weights.

Usage

1
prop_estimation(sample, weights, estimated_vars, class, N = NULL)

Arguments

sample

A data frame containing the sample with the variables for which the means are to be calculated.

weights

A vector of pre-calculated weights.

estimated_vars

String vector specifying the variables in the sample to be estimated.

class

String vector specifying which class (value) proportion is to be estimated in each variable. The i-th element of this vector corresponds to the class of which proportion is desired to estimate of the i-th variable of the vector specified in estimated_vars.

N

An integer specifying the population size (optional).

Value

A vector with the corresponding estimations.

Examples

1
2
3
4
5
6
7
covariates = c("education_primaria", "education_secundaria")
data_propensities = propensities(sampleNP, sampleP, covariates)
psa_weights = sc_weights(data_propensities$convenience)

#The function will estimate the proportion of individuals
#with the 0 value in vote_pens and the 1 value in vote_pir
prop_estimation(sampleNP, psa_weights, c("vote_pens", "vote_pir"), c(0, 1))

NonProbEst documentation built on July 1, 2020, 6:08 p.m.