-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't run crosstabs examples on CRAN
- Loading branch information
1 parent
9456291
commit 60273ae
Showing
2 changed files
with
158 additions
and
154 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,77 +1,79 @@ | ||
#### -------------------- association test ------------------------ #### | ||
|
||
# ------------------------ frequentist --------------------------------- | ||
|
||
# unpaired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = mtcars, | ||
x = am, | ||
y = vs, | ||
paired = FALSE | ||
) | ||
|
||
# paired | ||
|
||
paired_data <- tibble( | ||
response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), | ||
response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), | ||
Freq = c(65L, 25L, 5L, 5L) | ||
) | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = paired_data, | ||
x = response_before, | ||
y = response_after, | ||
paired = TRUE, | ||
counts = Freq | ||
) | ||
|
||
# ------------------------ Bayesian ------------------------------------- | ||
|
||
# unpaired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = mtcars, | ||
x = am, | ||
y = vs, | ||
paired = FALSE, | ||
type = "bayes" | ||
) | ||
|
||
# paired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = paired_data, | ||
x = response_before, | ||
y = response_after, | ||
paired = TRUE, | ||
counts = Freq, | ||
type = "bayes" | ||
) | ||
|
||
#### -------------------- goodness-of-fit test -------------------- #### | ||
|
||
# ------------------------ frequentist --------------------------------- | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = as.data.frame(HairEyeColor), | ||
x = Eye, | ||
counts = Freq | ||
) | ||
|
||
# ------------------------ Bayesian ------------------------------------- | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = as.data.frame(HairEyeColor), | ||
x = Eye, | ||
counts = Freq, | ||
ratio = c(0.2, 0.2, 0.3, 0.3), | ||
type = "bayes" | ||
) | ||
if (identical(Sys.getenv("NOT_CRAN"), "true")) { | ||
#### -------------------- association test ------------------------ #### | ||
|
||
# ------------------------ frequentist --------------------------------- | ||
|
||
# unpaired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = mtcars, | ||
x = am, | ||
y = vs, | ||
paired = FALSE | ||
) | ||
|
||
# paired | ||
|
||
paired_data <- tibble( | ||
response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), | ||
response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), | ||
Freq = c(65L, 25L, 5L, 5L) | ||
) | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = paired_data, | ||
x = response_before, | ||
y = response_after, | ||
paired = TRUE, | ||
counts = Freq | ||
) | ||
|
||
# ------------------------ Bayesian ------------------------------------- | ||
|
||
# unpaired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = mtcars, | ||
x = am, | ||
y = vs, | ||
paired = FALSE, | ||
type = "bayes" | ||
) | ||
|
||
# paired | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = paired_data, | ||
x = response_before, | ||
y = response_after, | ||
paired = TRUE, | ||
counts = Freq, | ||
type = "bayes" | ||
) | ||
|
||
#### -------------------- goodness-of-fit test -------------------- #### | ||
|
||
# ------------------------ frequentist --------------------------------- | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = as.data.frame(HairEyeColor), | ||
x = Eye, | ||
counts = Freq | ||
) | ||
|
||
# ------------------------ Bayesian ------------------------------------- | ||
|
||
set.seed(123) | ||
contingency_table( | ||
data = as.data.frame(HairEyeColor), | ||
x = Eye, | ||
counts = Freq, | ||
ratio = c(0.2, 0.2, 0.3, 0.3), | ||
type = "bayes" | ||
) | ||
} |