Skip to content

Commit

Permalink
add test for comparison to cosinor::cosinor.lm() for srr G4.b, and fi…
Browse files Browse the repository at this point in the history
…x typo in srr-stats-standards.R (RE7.0)
  • Loading branch information
RWParsons committed Aug 22, 2023
1 parent 5f98b8e commit 45cf0b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Imports:
scales,
stats
Suggests:
cosinor,
covr,
dplyr,
DT,
Expand Down
2 changes: 1 addition & 1 deletion R/srr-stats-standards.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ NULL
#' @srrstatsNA {RE4.15}
#' @srrstatsNA {RE4.16}
#' @srrstatsNA {RE5.0}
# @srrstatsNA {RE7.0}
#' @srrstatsNA {RE7.0}
#' @srrstatsNA {RE7.0a}
#' @srrstatsNA {RE7.1}
#' @srrstatsNA {RE7.1a}
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-cosinor.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @srrstats {G5.5}
#' @srrstats {G5.4}
#' @srrstats {G5.4a}
#' @srrstats {G5.4b}
#' @srrstats {G5.6}
#' @srrstats {G5.6a}
#' @srrstats {G5.6b}
Expand Down Expand Up @@ -50,13 +51,25 @@ test_that("model returns accurate parameters", {
),
data = comod
)
cosinor_lm_mod <- cosinor::cosinor.lm(Y ~ time(times) + group + amp.acro(group), data = comod)
}
)
testthat::expect_true(all.equal(
f_round(object$coefficients),
c(1.0030, -0.4966, 2.0122, 0.9948, 3.0115, 0.3175)
))

# test similarity to cosinor::cosinor.lm()
comparison_df <- cbind(
cosinor_lm_mod$coefficients,
object$coefficients
)

comparison_df <- as.data.frame(comparison_df[rownames(comparison_df) != "acr", ])
expect_equal(comparison_df$V1, comparison_df$V2, tolerance = 0.1)



# test another parameter estimation of Gaussian simulated data
withr::with_seed(
100,
Expand Down

0 comments on commit 45cf0b2

Please sign in to comment.