# Simulate some data:
dat = simulate_tlm(n = 200, p = 10, g_type = 'step')
# Point estimates for the linear coefficients:
theta_hat = suppressWarnings(
rank_approx(y = dat$y,
X = dat$X[,-1]) # remove intercept
) # warnings occur from glm.fit (fitted probabilities 0 or 1)
# Check: correlation with true coefficients
cor(dat$beta_true[-1], # excluding the intercept
theta_hat)
Run the code above in your browser using DataLab