Skip to content

Commit

Permalink
Render under latest bookdown and Statamarkdown
Browse files Browse the repository at this point in the history
  • Loading branch information
remlapmot committed Dec 5, 2023
1 parent 490bf2f commit e423118
Show file tree
Hide file tree
Showing 71 changed files with 2,062 additions and 2,071 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.
3,260 changes: 1,630 additions & 1,630 deletions data/nhefs.csv

Large diffs are not rendered by default.

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.
Binary file modified docs/11-why-model-r_files/figure-html/unnamed-chunk-1-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/11-why-model-r_files/figure-html/unnamed-chunk-1-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/11-why-model-r_files/figure-html/unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions docs/11-why-model-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ all files already exist and are up to date.
checking tomata consistency and verifying not already installed...
all files already exist and are up to date.
end of do-file
```

```
Expand Down
20 changes: 10 additions & 10 deletions docs/13-stand-gformula-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ summary(glm.obj)
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.500e-01 2.552e-01 0.980 0.342
## A 2.602e-16 3.608e-01 0.000 1.000
## A 3.957e-17 3.608e-01 0.000 1.000
## L 4.167e-01 3.898e-01 1.069 0.301
## A:L -3.237e-16 4.959e-01 0.000 1.000
## A:L -1.313e-16 4.959e-01 0.000 1.000
##
## (Dispersion parameter for gaussian family taken to be 0.2604167)
##
Expand Down Expand Up @@ -345,13 +345,13 @@ bootstrap <-
))
bootstrap
## V1 mean se ll
## 1 Observed 2.56188497106103 0.111490524910664 2.34336755761866
## 2 No Treatment 1.65212306626748 0.146316287347159 1.36534841271544
## 3 Treatment 5.1147448954934 0.363908173238617 4.40149798226595
## 4 Treatment - No Treatment 3.46262182922592 0.423315384649148 2.63293892121187
## 1 Observed 2.56188497106099 0.2624453491695 2.04750153877873
## 2 No Treatment 1.65212306626744 0.280450871584822 1.10244945852832
## 3 Treatment 5.11474489549336 0.219898563981165 4.6837516298382
## 4 Treatment - No Treatment 3.46262182922592 0.210381517824761 3.05028163127652
## ul
## 1 2.7804023845034
## 2 1.93889771981953
## 3 5.82799180872085
## 4 4.29230473723997
## 1 3.07626840334325
## 2 2.20179667400655
## 3 5.54573816114852
## 4 3.87496202717532
```
18 changes: 9 additions & 9 deletions docs/15-prop-scores-r.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,15 +734,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.250578351618104 2.14272154780789
## 2 No Treatment 1.71983636149845 0.181128320605523 1.3648313765314
## 3 Treatment 5.35072300362985 0.602689625221556 4.16947304433966
## 4 Treatment - No Treatment 3.6308866421314 0.640841786137571 2.37485982151344
## 1 Observed 2.63384609228479 0.163790897037714 2.31282183309537
## 2 No Treatment 1.71983636149845 0.093388447625048 1.53679836758125
## 3 Treatment 5.35072300362985 0.482765980920664 4.4045190680642
## 4 Treatment - No Treatment 3.6308866421314 0.468984551154229 2.71169381256343
## ul
## 1 3.12497063676169
## 2 2.0748413464655
## 3 6.53197296292004
## 4 4.88691346274936
## 1 2.95487035147422
## 2 1.90287435541565
## 3 6.29692693919551
## 4 4.55007947169937
```


Expand Down Expand Up @@ -835,7 +835,7 @@ for(i in 1:nboot) {
}
}
## 95% CI for the causal mean difference
## 2.62305 , 4.458254
## 2.54958 , 4.53291
```

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.
Binary file modified docs/15-prop-scores-r_files/figure-html/unnamed-chunk-3-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/15-prop-scores-r_files/figure-html/unnamed-chunk-3-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/17-causal-surv-r_files/figure-html/unnamed-chunk-2-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/17-causal-surv-r_files/figure-html/unnamed-chunk-3-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/17-causal-surv-r_files/figure-html/unnamed-chunk-4-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/17-causal-surv-r_files/figure-html/unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions docs/17-causal-surv-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ psurv1 float %9.0g psurv, interv == Duplicated observ
26. drop if newseqn != 1 /* only need one pair */
27.
r; t=0.00 10:11:06
r; t=0.00 12:00:29
Command: bootipw_surv
PrY_a0: r(boot_0)
Expand All @@ -630,7 +630,7 @@ r; t=0.00 10:11:06
Simulations (10)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..........
r; t=18.94 10:11:25
r; t=17.77 12:00:47
Expand Down Expand Up @@ -857,7 +857,8 @@ meanS_t1 float %9.0g meanS_t, interv == Duplicated
observation
file ./figs/stata-fig-17-4.png saved as PNG format
file /Users/tom/Documents/GitHub/cibookex-r/figs/stata-fig-17-4.png saved as PNG
format
(3,132 observations deleted)
Expand All @@ -867,7 +868,7 @@ file ./figs/stata-fig-17-4.png saved as PNG format
5. drop if time != 0
6. /*only predict on new version of data */
r; t=0.00 10:11:31
r; t=0.00 12:00:54
Command: bootstdz_surv
PrY_a0: r(boot_0)
Expand All @@ -877,7 +878,7 @@ r; t=0.00 10:11:31
Simulations (10)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..........
r; t=21.11 10:11:52
r; t=20.52 12:01:14
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 @@ -9,35 +9,34 @@ For reproducibility.
sessioninfo::session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
## setting value
## version R version 4.3.2 (2023-10-31 ucrt)
## os Windows 11 x64 (build 22621)
## system x86_64, mingw32
## ui RTerm
## version R version 4.3.2 (2023-10-31)
## os macOS Sonoma 14.1.2
## system aarch64, darwin20
## ui X11
## language (EN)
## collate English_United Kingdom.utf8
## ctype English_United Kingdom.utf8
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Europe/London
## date 2023-11-01
## pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
## date 2023-12-05
## pandoc 3.1.9 @ /opt/homebrew/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date (UTC) lib source
## bookdown 0.36 2023-10-16 [1] CRAN (R 4.3.1)
## bookdown 0.37 2023-12-01 [1] CRAN (R 4.3.2)
## cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)
## digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1)
## evaluate 0.22 2023-09-29 [1] CRAN (R 4.3.1)
## evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
## fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
## htmltools 0.5.6.1 2023-10-06 [1] CRAN (R 4.3.1)
## htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2)
## knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
## rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)
## rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.2)
## rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.1)
## rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.1)
## sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
## xfun 0.40 2023-08-09 [1] CRAN (R 4.3.1)
## xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
## yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)
##
## [1] C:/Users/tom/AppData/Local/R/win-library/4.3
## [2] C:/Program Files/R/R-4.3.2/library
## [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
##
## ──────────────────────────────────────────────────────────────────────────────
```
38 changes: 18 additions & 20 deletions docs/18-session-info-stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ about
```

```
Stata/MP 17.0 for Windows (64-bit x86-64)
Revision 29 Aug 2023
Stata/MP 17.0 for Mac (Apple Silicon)
Revision 14 Nov 2023
Copyright 1985-2021 StataCorp LLC
Total physical memory: 32.00 GB
Available physical memory: 20.19 GB
Total physical memory: 8.01 GB
Stata license: Unlimited-user 2-core network, expiring 21 Jan 2024
Serial number: 501709378202
Expand All @@ -32,36 +31,35 @@ Serial number: 501709378202
sessioninfo::session_info()
Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.3.2 (2023-10-31 ucrt)
os Windows 11 x64 (build 22621)
system x86_64, mingw32
ui RTerm
version R version 4.3.2 (2023-10-31)
os macOS Sonoma 14.1.2
system aarch64, darwin20
ui X11
language (EN)
collate English_United Kingdom.utf8
ctype English_United Kingdom.utf8
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/London
date 2023-11-01
pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
date 2023-12-05
pandoc 3.1.9 @ /opt/homebrew/bin/ (via rmarkdown)

Packages ───────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bookdown 0.36 2023-10-16 [1] CRAN (R 4.3.1)
bookdown 0.37 2023-12-01 [1] CRAN (R 4.3.2)
cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)
digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1)
evaluate 0.22 2023-09-29 [1] CRAN (R 4.3.1)
evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
htmltools 0.5.6.1 2023-10-06 [1] CRAN (R 4.3.1)
htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2)
knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)
rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.2)
rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.1)
rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
Statamarkdown * 0.8.0 2023-06-01 [1] CRAN (R 4.3.1)
xfun 0.40 2023-08-09 [1] CRAN (R 4.3.1)
Statamarkdown * 0.9.2 2023-12-04 [1] CRAN (R 4.3.1)
xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)

[1] C:/Users/tom/AppData/Local/R/win-library/4.3
[2] C:/Program Files/R/R-4.3.2/library
[1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library

──────────────────────────────────────────────────────────────────────────────
```
7 changes: 4 additions & 3 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.36 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.37 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="2023-11-01" />
<meta name="date" content="2023-12-05" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -59,7 +59,7 @@

<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
Expand Down Expand Up @@ -132,6 +132,7 @@
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging div.csl-entry {
margin-left:2em;
Expand Down
18 changes: 10 additions & 8 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.36 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.37 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="2023-11-01" />
<meta name="date" content="2023-12-05" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -59,7 +59,7 @@

<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
Expand Down Expand Up @@ -132,6 +132,7 @@
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging div.csl-entry {
margin-left:2em;
Expand Down Expand Up @@ -906,7 +907,7 @@ <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 10:04:50
r; t=0.00 11:56:33

Command: bootipw_surv
PrY_a0: r(boot_0)
Expand All @@ -916,7 +917,7 @@ <h2>Program 17.3<a href="causal-survival-analysis-stata.html#program-17.3-1" cla
Simulations (10)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..........
r; t=18.38 10:05:08
r; t=17.63 11:56:51



Expand Down Expand Up @@ -1137,7 +1138,8 @@ <h2>Program 17.4<a href="causal-survival-analysis-stata.html#program-17.4-1" cla
observation


file ./figs/stata-fig-17-4.png saved as PNG format
file /Users/tom/Documents/GitHub/cibookex-r/figs/stata-fig-17-4.png saved as PNG
format

(3,132 observations deleted)

Expand All @@ -1147,7 +1149,7 @@ <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 10:05:14
r; t=0.00 11:56:58

Command: bootstdz_surv
PrY_a0: r(boot_0)
Expand All @@ -1157,7 +1159,7 @@ <h2>Program 17.4<a href="causal-survival-analysis-stata.html#program-17.4-1" cla
Simulations (10)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..........
r; t=22.29 10:05:37
r; t=20.26 11:57:18



Expand Down
7 changes: 4 additions & 3 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.36 and GitBook 2.6.7" />
<meta name="generator" content="bookdown 0.37 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="2023-11-01" />
<meta name="date" content="2023-12-05" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -59,7 +59,7 @@

<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
Expand Down Expand Up @@ -132,6 +132,7 @@
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging div.csl-entry {
margin-left:2em;
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 e423118

Please sign in to comment.