Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug that previously broke the propensity option #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

junyangq
Copy link
Collaborator

@junyangq junyangq commented Mar 14, 2022

There is a bug caused by mistyping in a previous commit. This PR tries to fix that.

> library(causalLearning)
> set.seed(1223)
> n = 100 # number of training-set patients to simulate
> p = 10  # number of features for each training-set patient
> x = matrix(rnorm(n * p), nrow = n, ncol = p) # simulate covariate matrix
> tx_effect = x[, 1] + (x[, 2] > 0) # simple heterogeneous treatment effect
> tx = rbinom(n, size = 1, p = 0.5) # random treatment assignment
> y = rowMeans(x) + tx * tx_effect + rnorm(n, sd = 0.001) # simulate response
> stratum = sample(rep(1:2, length = n))
> table(tx, stratum)
   stratum
tx   1  2
  0 34 29
  1 16 21
> #   stratum
> #tx   1  2
> #  0 23 21
> #  1 27 29
> fit_cb = causalLearning::causalBoosting(x, tx, y, num.trees = 500, propensity = TRUE, stratum = stratum)
> dim(fit_cb$tauhat)
[1] 100 500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant