Skip to contents

A step of the causal implementation. Called by morie_estimate_aipw, morie_estimate_atc, morie_estimate_ate and 1 others in the module. See the file header for the source the module follows. it follows.

Usage

morie_estimate_propensity_scores(
  data,
  treatment,
  covariates,
  trim = c(0.01, 0.99),
  trim_type = "value",
  ps_model = "mle",
  ridge_lambda = 1
)

Arguments

data

Passed to .fit_propensity.

treatment

Passed to .fit_propensity.

covariates

Passed to .fit_propensity.

trim

Passed to .mor_trim_ps. Defaults to c(0.01, 0.99).

trim_type

Passed to .mor_trim_ps. Defaults to "value".

ps_model

Passed to .fit_propensity. Defaults to "mle".

ridge_lambda

Passed to .fit_propensity. Defaults to 1.

Value

The value of .mor_trim_ps.

Examples

set.seed(1)
df <- data.frame(t = rbinom(60, 1, 0.4), x = rnorm(60))
morie_estimate_propensity_scores(df, "t", "x")
#>  [1] 0.3797868 0.4231844 0.4084517 0.4217064 0.4620416 0.4326360 0.4320076
#>  [8] 0.4218725 0.3873498 0.3972809 0.4250491 0.4277362 0.3992432 0.4034120
#> [15] 0.4409645 0.4415359 0.4091419 0.3971222 0.4234730 0.3937939 0.4081400
#> [22] 0.4386267 0.4098435 0.4544370 0.3776235 0.3618506 0.4311864 0.4518252
#> [29] 0.4030234 0.4241587 0.3499105 0.4212672 0.3994575 0.4192411 0.4426272
#> [36] 0.4144075 0.4752182 0.3766785 0.4154745 0.3563798 0.4058297 0.4416107
#> [43] 0.4018039 0.4484570 0.4582498 0.4113301 0.4334952 0.4200512 0.4178465
#> [50] 0.4379415 0.4373068 0.4241625 0.3850614 0.4665481 0.4023028 0.4100879
#> [57] 0.3884341 0.4292754 0.4089793 0.4120594