Skip to content

Commit

Permalink
fix propensity score code
Browse files Browse the repository at this point in the history
  • Loading branch information
tdebray123 committed Oct 11, 2024
1 parent 8063da5 commit 5b65068
Show file tree
Hide file tree
Showing 16 changed files with 617 additions and 364 deletions.
5 changes: 3 additions & 2 deletions _freeze/chapter_06/execute-results/html.json

Large diffs are not rendered by default.

Binary file modified _freeze/chapter_06/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/chapter_06/figure-html/unnamed-chunk-12-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/chapter_06/figure-html/unnamed-chunk-12-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/chapter_06/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions chapter_06.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ plot(opt, type = "density", which.xs = vars)

### Estimating the ATT

We can estimate the ATT in the matched sample using Poisson regression in which the number of post-treatment relapses is regressed on treatment status and follow-up time for each patient (captured by the variable `years`). More details are provided at \url{https://cran.r-project.org/web/packages/MatchIt/vignettes/estimating-effects.html}.
We can estimate the ATT in the matched sample using Poisson regression in which the number of post-treatment relapses is regressed on treatment status and follow-up time for each patient (captured by the variable `years`). More details are provided at [this link](https://cran.r-project.org/web/packages/MatchIt/vignettes/estimating-effects.html).

```{r}
# Matched data
Expand All @@ -310,12 +310,12 @@ opt.fit <- glm(y ~ treatment + offset(log(years)),
weights = weights)
# Treatment effect estimation
opt.comp <- comparisons(opt.fit,
variables = "treatment",
vcov = ~subclass,
newdata = subset(matched.data, treatment == "DMT1"),
wts = "weights",
transform_pre = "ratio")
opt.comp <- avg_comparisons(opt.fit,
variables = "treatment",
vcov = ~subclass,
newdata = subset(matched.data, treatment == "DMT1"),
wts = "weights",
comparison = "ratio")
opt.comp |> tidy()
```
Expand Down
Binary file modified chapter_06_files/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chapter_06_files/figure-html/unnamed-chunk-12-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chapter_06_files/figure-html/unnamed-chunk-12-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified chapter_06_files/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
907 changes: 561 additions & 346 deletions docs/chapter_06.html

Large diffs are not rendered by default.

Binary file modified docs/chapter_06_files/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/chapter_06_files/figure-html/unnamed-chunk-12-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/chapter_06_files/figure-html/unnamed-chunk-12-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/chapter_06_files/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 46 additions & 9 deletions docs/search.json

Large diffs are not rendered by default.

0 comments on commit 5b65068

Please sign in to comment.