Skip to content

Commit

Permalink
replace 'symmetric' with 'square' in documentation (correct terminolo…
Browse files Browse the repository at this point in the history
…gy).
  • Loading branch information
oliverodolin committed Aug 7, 2024
1 parent 0336a92 commit ec6c47b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions R/check_trans_probs.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Check Transition Probability Matrix
#'
#' This function checks the properties of a transition probability matrix conform to
#' standard expectations. That it is: symmetric, numeric, values are between 0
#' standard expectations. That it is: square, numeric, values are between 0
#' and 1 with all rows summing to 1. If a dead state is provided, it checks that the dead
#' state -> dead state probability is 1.
#'
Expand Down Expand Up @@ -40,9 +40,9 @@ check_trans_prob_mat <- function(m_P,
# no warnings
no_warnings <- T

# Check that the matrix is symmetric
# Check that the matrix is square
if (ncol(m_P) != nrow(m_P)) {
message <- "Transition matrix is not symmetric."
message <- "Transition matrix is not square."
no_warnings <- F
if (stop_if_not) {
stop(message)
Expand Down Expand Up @@ -200,9 +200,9 @@ check_array_names_complete <- function(a_P, stop_if_not = F){
n_row <- dim(a_P)[1]
n_col <- dim(a_P)[2]

# Check that the array is symmetric on dim 1 and 2
# Check that the array is square on dim 1 and 2
if (n_row != n_col) {
message <- paste0("Transition array is not symmetric: ", n_row, " rows, and ", n_col, " columns")
message <- paste0("Transition array is not square: ", n_row, " rows, and ", n_col, " columns")
no_warnings <- F
if (stop_if_not) {
stop(message)
Expand Down Expand Up @@ -266,7 +266,7 @@ check_dead_state_rows <- function(a_P, dead_state = NULL, stop_if_not = F) {
#'
#' This function checks the properties of a transition probability array with
#' 2 or three dimensions conform to standard expectations. That it is that each slice is:
#' symmetric, numeric, values are between 0 and 1 with all rows summing to 1.
#' square, numeric, values are between 0 and 1 with all rows summing to 1.
#' If a dead state is provided, it checks that the dead state -> dead state probability
#' in each slice is equal to 1.
#'
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ for(x in 1:n_t){
}
# Use the function from the package.
# This check should return no error, the array is symmetric, numeric, values
# This check should return no error, the array is square, numeric, values
# are between 0 and 1 and all rows sum to 1.
# Note: stop_if_not = F returns warnings, stop_if_not = T returns errors.
check_trans_prob_array(a_P = a_P,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ for(x in 1:n_t){
}

# Use the function from the package.
# This check should return no error, the array is symmetric, numeric, values
# This check should return no error, the array is square, numeric, values
# are between 0 and 1 and all rows sum to 1.
# Note: stop_if_not = F returns warnings, stop_if_not = T returns errors.
check_trans_prob_array(a_P = a_P,
Expand Down
2 changes: 1 addition & 1 deletion man/check_trans_prob_array.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/check_trans_prob_mat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-check_trans_probs.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test_that(desc = "check_trans_prob_mat should issue warnings (or errors) for inv

check_trans_prob_mat(m_P, stop_if_not = F) |>
capture_warnings() |>
expect_equal(expected = "Transition matrix is not symmetric.")
expect_equal(expected = "Transition matrix is not square.")

check_trans_prob_mat(m_P, stop_if_not = T) |>
expect_error()
Expand Down

0 comments on commit ec6c47b

Please sign in to comment.