generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2024-09-03 update : adding spatial vignette. (#143)
* 2024-09-03 update : adding spatial vignette. * 2024-09-03 update : fixing libraries in spatial vignette. * 2024-09-04 update : cont. spatial vignette * 2024-09-06 update : pushing latest. * 2024-09-09 update : editing vignette. * 2024-09-10 update : merging spatial-main. * 2024-09-10 update : updating vignette. * Kj tweaks to 123 (#159) * modify seed and revert to old R(t) for testing, add inits * fix length of norm vec aux site * add identity matrix as initial cholesky decomp matrix * tweak initialization * tweak plots * make prior on phi lower to approx iid case more * 2024-09-11 update : testing spatial vignette. --------- Co-authored-by: cbernalz <[email protected]> * 2024-09-11 update : cont. vignette. * 2024-09-13 update : vignette comp. * solution to initialization, pass in 2 x2 matrix for L omega if corr structure switch !=2 (#165) * 2024-09-16 update : resolving KJ requested changes. * 2024-09-17 update : resolving KJ requested changes. * Update _pkgdown.yml (#167) * Update _pkgdown.yml * add mathcal R(t) to getting started vignette * 2024-09-17 update : merging KJ branch. * 2024-09-17 update : resolving KJ requested changes. --------- Co-authored-by: Kaitlyn Johnson <[email protected]>
- Loading branch information
1 parent
a6d1d10
commit bf49587
Showing
17 changed files
with
2,722 additions
and
50 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
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
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
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
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
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
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,49 @@ | ||
#' Generates a random correlation matrix. | ||
#' | ||
#' @param corr_function_params Structured as follows : {n_sites, seed}. | ||
#' Ensure that this list follows this structure. Number of sites n_sites, and | ||
#' seed desired for rng. Defaults are set to NULL. | ||
#' @export | ||
#' | ||
#' @return Correlation matrix. A symmetric matrix with off diagonal values | ||
#' sampled randomly from -1 to 1, using a uniform distribution. | ||
#' | ||
rand_corr_matrix_func <- function( | ||
corr_function_params = list( | ||
n_sites = NULL, | ||
seed = NULL | ||
)) { | ||
# error managing | ||
stopifnot( | ||
"corr_function_params : NOT STRUCTURED CORRECTLY!!!\n | ||
List names should be : {n_sites, seed}" = | ||
names(corr_function_params) == c("n_sites", "seed") | ||
) | ||
# presets | ||
n_sites <- corr_function_params$n_sites | ||
seed <- corr_function_params$seed | ||
set.seed(seed) | ||
random_matrix <- matrix( | ||
data = runif( | ||
n_sites * n_sites, | ||
min = -1, max = 1 | ||
), | ||
nrow = n_sites | ||
) | ||
sym_matrix <- (random_matrix + t(random_matrix)) / 2 | ||
eigen_decomp <- eigen( | ||
sym_matrix | ||
) | ||
positive_semi_definite_matrix <- eigen_decomp$vectors %*% | ||
diag( | ||
pmax( | ||
eigen_decomp$values, | ||
0 | ||
) | ||
) %*% | ||
t(eigen_decomp$vectors) | ||
diag(positive_semi_definite_matrix) <- 1 | ||
|
||
|
||
return(round(positive_semi_definite_matrix, 4)) | ||
} |
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,3 +1,4 @@ | ||
url: https://cdcgov.github.io/ww-inference-model/ | ||
template: | ||
bootstrap: 5 | ||
math-rendering: katex |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
man/independence_corr_func.Rd → man/independence_corr_func_r.Rd
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.