margin_mean: Estimates average y for groups A and B (marginals) and the...

View source: R/nopodec_mean.R

margin_meanR Documentation

Estimates average y for groups A and B (marginals) and the number of observations.

Description

Estimates average y for groups A and B (marginals) and the number of observations.

Usage

margin_mean(...)

## Default S3 method:
margin_mean(.reweight_strata_all, y = NULL, weights = NULL, ...)

## S3 method for class 'reweighted'
margin_mean(.reweighted, ...)

Arguments

...

arguments passed to or from other methods.

.reweight_strata_all

output of reweight_strata_all2

y

name of the outcome variable for which you want to make the decomposition. If NULL (default), the value is inherited from the attributes of .reweight_strata_all

weights

name of the weight variable (sample weights). If NULL (default), the value is inherited from the attributes of .reweight_strata_all.

.reweighted

an object of class reweighted (the output of reweight_strata_all4)

Value

a data frame with two rows (one for each group) and the follwing three columns:

  • the name of the treatment column used in reweight_strata_all2;

  • ybar: average of the y variable;

  • Nhat: estimate of the number of individuals.

Examples

data(invented_wages)

r00 <- reweight_strata_all2(invented_wages, treatment = "gender",
                            variables = c("sector", "education"),
                            y = "wage", weights = "sample_weights")

margin_mean(r00)

data(invented_wages)
r00 <- reweight_strata_all4(invented_wages, treatment = "gender",
                       variables = c("sector", "education"),
                       y = "wage", weights = "sample_weights")

str(r00)
names(r00)
class(r00)

margin_mean(r00)


gibonet/decr documentation built on Jan. 5, 2024, 7:26 a.m.