start_ls: Starting Values

Description Usage Arguments Details Value Examples

View source: R/ls_functions.R

Description

Computes the starting values for proportion, mean, and variance for optimization. The proportions pi are transformed to relative sizes.

Usage

1
start_ls(data, rand = FALSE)

Arguments

data

data frame containing cols y (positive outcome with zeros) and z (treatment).

rand

boolean controlling whether random adjusted starting mean values are produced.

Details

For the input data frame, column z is the dummy variable for treatment. If z = 1, then the observation has received treatment. If z = 0, then the observation has not received treatment.
By allowing rand=TRUE, the optim() in mle_ls() can be started in multiple places, providing random adj values while remaining within reasonable bounds.

Value

starting values used for maximum-likelihood optimization.

Examples

1
2
3
4
5
sim = sim_latent_strat(n=10000, piA=0.2, piB=0.1, muA1=5, muA0=4.5, muB1=3, sigma=0.3)
start_ls(sim$data)

# if wish to have multiple random starting values
start_ls(sim$data, rand=TRUE)

zthuang0422/PURM-2021-Latent-Stratification documentation built on Dec. 23, 2021, 10:12 p.m.