Skip to content

Commit

Permalink
rmarkdown::render_site()
Browse files Browse the repository at this point in the history
  • Loading branch information
remlapmot committed Nov 13, 2024
1 parent 42f3c9d commit 5ba6954
Show file tree
Hide file tree
Showing 42 changed files with 259 additions and 266 deletions.
Binary file modified data/fig1.dta
Binary file not shown.
Binary file modified data/fig2.dta
Binary file not shown.
Binary file modified data/fig3.dta
Binary file not shown.
Binary file modified data/nhefs-formatted.dta
Binary file not shown.
Binary file modified data/nhefs-highprice.dta
Binary file not shown.
Binary file modified data/nhefs-ps.dta
Binary file not shown.
Binary file modified data/nhefs-wcens.dta
Binary file not shown.
Binary file modified data/nhefs_std.dta
Binary file not shown.
Binary file modified data/nhefs_std1.dta
Binary file not shown.
Binary file modified data/nhefs_std2.dta
Binary file not shown.
Binary file modified data/nhefs_surv.dta
Binary file not shown.
Binary file modified data/observe.mmat
Binary file not shown.
18 changes: 9 additions & 9 deletions docs/13-stand-gformula-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ bootstrap <-
ul
))
bootstrap
#> V1 mean se ll
#> 1 Observed 2.56188497106099 0.179264623075632 2.2105327661306
#> 2 No Treatment 1.65212306626744 0.230834513113006 1.19969573417711
#> 3 Treatment 5.11474489549336 0.251603947724678 4.62161021958489
#> 4 Treatment - No Treatment 3.46262182922592 0.318267311315707 2.83882936159074
#> V1 mean se ll
#> 1 Observed 2.56188497106099 0.0549704676078034 2.45414483433637
#> 2 No Treatment 1.65212306626744 0.143266399330196 1.37132608338552
#> 3 Treatment 5.11474489549336 0.38239206319866 4.36527022365002
#> 4 Treatment - No Treatment 3.46262182922592 0.508889999498158 2.46521575811692
#> ul
#> 1 2.91323717599137
#> 2 2.10455039835777
#> 3 5.60787957140182
#> 4 4.0864142968611
#> 1 2.66962510778561
#> 2 1.93292004914935
#> 3 5.86421956733669
#> 4 4.46002790033492
```
16 changes: 8 additions & 8 deletions docs/14-g-est-snms-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ library(Hmisc)
#> format.pval, units
describe(nhefs$wt82_71)
#> nhefs$wt82_71
#> n missing distinct Info Mean Gmd .05 .10
#> 1566 63 1510 1 2.638 8.337 -9.752 -6.292
#> .25 .50 .75 .90 .95
#> -1.478 2.604 6.690 11.117 14.739
#> n missing distinct Info Mean pMedian Gmd .05
#> 1566 63 1510 1 2.638 2.607 8.337 -9.752
#> .10 .25 .50 .75 .90 .95
#> -6.292 -1.478 2.604 6.690 11.117 14.739
#>
#> lowest : -41.2805 -30.5019 -30.0501 -29.0258 -25.9706
#> highest: 34.0178 36.9693 37.6505 47.5113 48.5384
Expand Down Expand Up @@ -302,10 +302,10 @@ summary(logit.est)
nhefs$pqsmk <- predict(logit.est, nhefs, type = "response")
describe(nhefs$pqsmk)
#> nhefs$pqsmk
#> n missing distinct Info Mean Gmd .05 .10
#> 1629 0 1629 1 0.2622 0.1302 0.1015 0.1261
#> .25 .50 .75 .90 .95
#> 0.1780 0.2426 0.3251 0.4221 0.4965
#> n missing distinct Info Mean pMedian Gmd .05
#> 1629 0 1629 1 0.2622 0.2524 0.1302 0.1015
#> .10 .25 .50 .75 .90 .95
#> 0.1261 0.1780 0.2426 0.3251 0.4221 0.4965
#>
#> lowest : 0.0514466 0.0515703 0.0543802 0.0558308 0.0593059
#> highest: 0.672083 0.686432 0.713913 0.733299 0.78914
Expand Down
18 changes: 9 additions & 9 deletions docs/15-prop-scores-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,15 +732,15 @@ bootstrap <- data.frame(cbind(c("Observed", "No Treatment", "Treatment",
"Treatment - No Treatment"), mean, se, ll, ul))
bootstrap
#> V1 mean se ll
#> 1 Observed 2.63384609228479 0.261636418047499 2.12104813586763
#> 2 No Treatment 1.71983636149845 0.24260296578913 1.24434328600916
#> 3 Treatment 5.35072300362985 0.496774052474323 4.37706375232617
#> 4 Treatment - No Treatment 3.6308866421314 0.478056388912057 2.69391333728449
#> 1 Observed 2.63384609228479 0.238861089903915 2.16568695876514
#> 2 No Treatment 1.71983636149845 0.197112530909323 1.33350290001464
#> 3 Treatment 5.35072300362985 0.587017349690794 4.20019013993574
#> 4 Treatment - No Treatment 3.6308866421314 0.592573338393775 2.46946424068094
#> ul
#> 1 3.14664404870196
#> 2 2.19532943698775
#> 3 6.32438225493354
#> 4 4.5678599469783
#> 1 3.10200522580445
#> 2 2.10616982298226
#> 3 6.50125586732396
#> 4 4.79230904358186
```


Expand Down Expand Up @@ -833,7 +833,7 @@ for(i in 1:nboot) {
}
}
#> 95% CI for the causal mean difference
#> 2.590947 , 4.499482
#> 2.679491 , 4.442331
```

A more flexible and elegant way to do this is to write a function to perform the model fitting, prediction, bootstrapping, and reporting all at once.
12 changes: 6 additions & 6 deletions docs/16-iv-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ivregress 2sls wt82_71 (qsmk = highprice)
```

```
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(1) = 0.01
Prob > chi2 = 0.9038
R-squared = 0.0213
Expand Down Expand Up @@ -294,7 +294,7 @@ ivregress 2sls wt82_71 (qsmk = highprice)
(1,476 real changes made)
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(1) = 0.06
Prob > chi2 = 0.8023
R-squared = .
Expand All @@ -314,7 +314,7 @@ Exogenous: highprice
(1,476 real changes made)
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(1) = 0.05
Prob > chi2 = 0.8274
R-squared = .
Expand All @@ -334,7 +334,7 @@ Exogenous: highprice
(1,476 real changes made)
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(1) = 0.55
Prob > chi2 = 0.4576
R-squared = .
Expand All @@ -354,7 +354,7 @@ Exogenous: highprice
(1,476 real changes made)
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(1) = 0.29
Prob > chi2 = 0.5880
R-squared = .
Expand Down Expand Up @@ -394,7 +394,7 @@ ivregress 2sls wt82_71 sex race c.age c.smokeintensity ///
(1,476 real changes made)
Instrumental variables 2SLS regression Number of obs = 1,476
Instrumental-variables 2SLS regression Number of obs = 1,476
Wald chi2(11) = 135.18
Prob > chi2 = 0.0000
R-squared = 0.0622
Expand Down
8 changes: 4 additions & 4 deletions docs/17-causal-surv-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,15 @@ psurv1 float %9.0g psurv, interv == Duplicated observ
26. drop if newseqn != 1 /* only need one pair */
27.
r; t=0.00 12:06:36
r; t=0.00 6:43:12
Command: bootipw_surv
PrY_a0: r(boot_0)
PrY_a1: r(boot_1)
difference: r(boot_diff)
Simulations (10): .........10 done
r; t=19.90 12:06:56
r; t=19.98 6:43:32
Expand Down Expand Up @@ -866,15 +866,15 @@ file /Users/tom/Documents/GitHub/cibookex-r/figs/stata-fig-17-4.png saved as PNG
5. drop if time != 0
6. /*only predict on new version of data */
r; t=0.00 12:07:04
r; t=0.00 6:43:39
Command: bootstdz_surv
PrY_a0: r(boot_0)
PrY_a1: r(boot_1)
difference: r(boot_diff)
Simulations (10): .........10 done
r; t=23.80 12:07:28
r; t=23.62 6:44:03
Expand Down
29 changes: 14 additions & 15 deletions docs/18-session-info-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,36 @@ For reproducibility.
``` r
# install.packages("sessioninfo")
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.1 (2024-06-14)
#> os macOS Sonoma 14.5
#> version R version 4.4.2 (2024-10-31)
#> os macOS Sequoia 15.1
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Berlin
#> date 2024-08-01
#> pandoc 3.2.1 @ /opt/homebrew/bin/ (via rmarkdown)
#> tz Europe/London
#> date 2024-11-13
#> pandoc 3.5 @ /opt/homebrew/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bookdown 0.40 2024-07-02 [1] CRAN (R 4.4.0)
#> bookdown 0.41 2024-10-16 [1] CRAN (R 4.4.1)
#> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0)
#> digest 0.6.36 2024-06-23 [1] CRAN (R 4.4.0)
#> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.4.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> evaluate 1.0.1 2024-10-10 [1] CRAN (R 4.4.1)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.4.1)
#> knitr 1.49 2024-11-08 [1] CRAN (R 4.4.1)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
#> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
#> rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
#> xfun 0.46 2024-07-18 [1] CRAN (R 4.4.1)
#> xfun 0.49 2024-10-31 [1] CRAN (R 4.4.1)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.1)
#>
#> [1] /Users/tom/Library/R/arm64/4.4/library
#> [2] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
```
31 changes: 15 additions & 16 deletions docs/18-session-info-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ about

```
StataNow/MP 18.5 for Mac (Apple Silicon)
Revision 16 Jul 2024
Revision 16 Oct 2024
Copyright 1985-2023 StataCorp LLC
Total physical memory: 8.01 GB
Expand All @@ -29,38 +29,37 @@ Serial number: 501809305331
``` r
# install.packages("sessioninfo")
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.1 (2024-06-14)
#> os macOS Sonoma 14.5
#> version R version 4.4.2 (2024-10-31)
#> os macOS Sequoia 15.1
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Berlin
#> date 2024-08-01
#> pandoc 3.2.1 @ /opt/homebrew/bin/ (via rmarkdown)
#> tz Europe/London
#> date 2024-11-13
#> pandoc 3.5 @ /opt/homebrew/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bookdown 0.40 2024-07-02 [1] CRAN (R 4.4.0)
#> bookdown 0.41 2024-10-16 [1] CRAN (R 4.4.1)
#> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0)
#> digest 0.6.36 2024-06-23 [1] CRAN (R 4.4.0)
#> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.4.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> evaluate 1.0.1 2024-10-10 [1] CRAN (R 4.4.1)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.4.1)
#> knitr 1.49 2024-11-08 [1] CRAN (R 4.4.1)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
#> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
#> rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
#> Statamarkdown * 0.9.2 2023-12-04 [1] CRAN (R 4.4.0)
#> xfun 0.46 2024-07-18 [1] CRAN (R 4.4.1)
#> xfun 0.49 2024-10-31 [1] CRAN (R 4.4.1)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.1)
#>
#> [1] /Users/tom/Library/R/arm64/4.4/library
#> [2] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
```
4 changes: 2 additions & 2 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page not found | Causal Inference: What If. R and Stata code for Exercises</title>
<meta name="description" content="Code examples from Causal Inference: What If by M. A. Hernán and J. M. Robins https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/" />
<meta name="generator" content="bookdown 0.40 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.41 and GitBook 2.6.7" />

<meta property="og:title" content="Page not found | Causal Inference: What If. R and Stata code for Exercises" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +26,7 @@
<meta name="author" content="R Markdown code by Tom Palmer" />


<meta name="date" content="2024-08-01" />
<meta name="date" content="2024-11-13" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
12 changes: 6 additions & 6 deletions docs/causal-survival-analysis-stata.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>17. Causal survival analysis: Stata | Causal Inference: What If. R and Stata code for Exercises</title>
<meta name="description" content="Code examples from Causal Inference: What If by M. A. Hernán and J. M. Robins https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/" />
<meta name="generator" content="bookdown 0.40 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.41 and GitBook 2.6.7" />

<meta property="og:title" content="17. Causal survival analysis: Stata | Causal Inference: What If. R and Stata code for Exercises" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +26,7 @@
<meta name="author" content="R Markdown code by Tom Palmer" />


<meta name="date" content="2024-08-01" />
<meta name="date" content="2024-11-13" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -907,15 +907,15 @@ <h2>Program 17.3<a href="causal-survival-analysis-stata.html#program-17.3-1" cla
26. drop if newseqn != 1 /* only need one pair */
27.

r; t=0.00 12:02:00
r; t=0.00 6:38:55

Command: bootipw_surv
PrY_a0: r(boot_0)
PrY_a1: r(boot_1)
difference: r(boot_diff)

Simulations (10): .........10 done
r; t=21.36 12:02:21
r; t=20.61 6:39:15



Expand Down Expand Up @@ -1147,15 +1147,15 @@ <h2>Program 17.4<a href="causal-survival-analysis-stata.html#program-17.4-1" cla
5. drop if time != 0
6. /*only predict on new version of data */

r; t=0.00 12:02:29
r; t=0.00 6:39:22

Command: bootstdz_surv
PrY_a0: r(boot_0)
PrY_a1: r(boot_1)
difference: r(boot_diff)

Simulations (10): .........10 done
r; t=24.50 12:02:54
r; t=23.75 6:39:46



Expand Down
4 changes: 2 additions & 2 deletions docs/causal-survival-analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>17. Causal survival analysis | Causal Inference: What If. R and Stata code for Exercises</title>
<meta name="description" content="Code examples from Causal Inference: What If by M. A. Hernán and J. M. Robins https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/" />
<meta name="generator" content="bookdown 0.40 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.41 and GitBook 2.6.7" />

<meta property="og:title" content="17. Causal survival analysis | Causal Inference: What If. R and Stata code for Exercises" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +26,7 @@
<meta name="author" content="R Markdown code by Tom Palmer" />


<meta name="date" content="2024-08-01" />
<meta name="date" content="2024-11-13" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
Binary file modified docs/cibookex-r.epub
Binary file not shown.
Binary file modified docs/cibookex-r.pdf
Binary file not shown.
Loading

0 comments on commit 5ba6954

Please sign in to comment.