-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# -*- coding: utf-8 -*- | ||
# --- | ||
# jupyter: | ||
# jupytext: | ||
# formats: ipynb,R:hydrogen | ||
# text_representation: | ||
# extension: .R | ||
# format_name: hydrogen | ||
# format_version: '1.3' | ||
# jupytext_version: 1.10.3 | ||
# kernelspec: | ||
# display_name: R | ||
# language: R | ||
# name: ir | ||
# --- | ||
|
||
# %% | ||
.Table <- matrix(c(15, 13, 5, 15), 2, 2, byrow=TRUE) | ||
print(.Table) | ||
|
||
# epiR で分析 | ||
analysis <- epiR::epi.2by2( | ||
dat = .Table, | ||
method = "cross.sectional", | ||
digits = 3, | ||
conf.level = 0.95, | ||
units = 1, | ||
outcome = "as.columns" | ||
) | ||
|
||
# Wald法 | ||
rr_result <- analysis$massoc.detail$PR.strata.wald | ||
cat("\nWald RR:\n") | ||
print(rr_result) | ||
|
||
# スコア法 | ||
rr_result <- analysis$massoc.detail$PR.strata.score | ||
cat("\nScore RR:\n") | ||
print(rr_result) | ||
|
||
# %% | ||
(15/(15+13))/(5/(5+15)) | ||
|
||
# %% | ||
(15/(15+5))/(13/(13+15)) | ||
|
||
# %% | ||
.Table <- matrix(c(15, 13, 5, 15), 2, 2, byrow=TRUE) | ||
|
||
# epiR で分析 | ||
analysis <- epiR::epi.2by2( | ||
dat = .Table, | ||
method = "cross.sectional", | ||
digits = 3, | ||
conf.level = 0.95, | ||
units = 1, | ||
outcome = "as.columns" | ||
) | ||
print(analysis) | ||
|
||
# Wald法 | ||
rr_result <- analysis$massoc.detail$PR.strata.wald | ||
cat("\nWald RR:\n") | ||
print(rr_result) | ||
|
||
# スコア法 | ||
rr_result <- analysis$massoc.detail$PR.strata.score | ||
cat("\nScore RR:\n") | ||
print(rr_result) | ||
|
||
# %% | ||
str(analysis) | ||
|
||
# %% | ||
.Table <- matrix(c(15, 13, 5, 15), 2, 2, byrow=FALSE) | ||
|
||
# epiR で分析 | ||
analysis <- epiR::epi.2by2( | ||
dat = .Table, | ||
method = "cross.sectional", | ||
digits = 3, | ||
conf.level = 0.95, | ||
units = 1, | ||
outcome = "as.columns" | ||
) | ||
print(analysis) | ||
|
||
# Wald法 | ||
rr_result <- analysis$massoc.detail$PR.strata.wald | ||
cat("\nWald RR:\n") | ||
print(rr_result) | ||
|
||
# スコア法 | ||
rr_result <- analysis$massoc.detail$PR.strata.score | ||
cat("\nScore RR:\n") | ||
print(rr_result) | ||
|
||
# %% | ||
str(analysis) | ||
|
||
# %% |
Oops, something went wrong.