Skip to content
Merged

Cran2 #170

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
^pkgdown$
^vignettes/articles$
^DO_NOT_COMMIT*
^demon.org
^\.#.*$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ docs
tools/lib
tools/*.html
\#\*R:scripts\*\#
demon.org
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.3.1
Date: 2025-08-18 20:38:57 UTC
SHA: 03f0cc66b17667d39907be289ad0930cfb6ea1f6
Version: 1.4.1
Date: 2026-06-23 12:55:28 UTC
SHA: 2f488b3aa26db9b410db06b9992defa0d3dabdcb
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pcvr
Type: Package
Title: Plant Phenotyping and Bayesian Statistics
Version: 1.4.0
Version: 1.4.1
Authors@R:
c(person("Josh", "Sumner", email = "jsumner@danforthcenter.org",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3399-9063")),
Expand All @@ -21,7 +21,7 @@ License: GPL-2
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
Additional_repositories: https://mc-stan.org/r-packages/
Additional_repositories: https://stan-dev.r-universe.dev
RoxygenNote: 7.3.2
Imports:
FactoMineR,
Expand Down
19 changes: 10 additions & 9 deletions R/barg.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@
#' "sigmaA" = 20, "sigmaB" = 10, "sigmaC" = 2
#' ), type = "brms"
#' )
#' fit_test <- fitGrowth(ss,
#' iter = 600, cores = 1, chains = 1, backend = "cmdstanr",
#' sample_prior = "only" # only sampling from prior for speed
#' )
#' b <- barg(fit_test, ss)
#' fit_2 <- fit_test
#' fit_list <- list(fit_test, fit_2)
#' x <- barg(fit_list, list(ss, ss))
#'
#' if (rlang::is_installed("cmdstanr")) {
#' fit_test <- fitGrowth(ss,
#' iter = 600, cores = 1, chains = 1, backend = "cmdstanr",
#' sample_prior = "only" # only sampling from prior for speed
#' )
#' b <- barg(fit_test, ss)
#' fit_2 <- fit_test
#' fit_list <- list(fit_test, fit_2)
#' x <- barg(fit_list, list(ss, ss))
#' }
#' x <- conjugate(
#' s1 = rnorm(10, 10, 1), s2 = rnorm(10, 13, 1.5), method = "t",
#' priors = list(
Expand Down
7 changes: 5 additions & 2 deletions R/brmPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#' @import ggplot2
#' @import viridis
#' @importFrom stats as.formula
#' @importFrom rlang is_installed
#' @examples
#' \donttest{
#' simdf <- growthSim(
Expand All @@ -36,8 +37,10 @@
#' list("A" = 130, "B" = 10, "C" = 3),
#' df = simdf, type = "brms"
#' )
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' growthPlot(fit = fit, form = y ~ time | group, groups = "a", df = ss$df)
#' if (rlang::is_installed("cmdstanr")) {
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' growthPlot(fit = fit, form = y ~ time | group, groups = "a", df = ss$df)
#' }
#' }
#'
#' @return Returns a ggplot showing a brms model's credible
Expand Down
14 changes: 9 additions & 5 deletions R/brmSurvPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' @import ggplot2
#' @import viridis
#' @importFrom stats as.formula
#' @importFrom rlang is_installed
#' @examples
#' \donttest{
#' set.seed(123)
Expand All @@ -28,17 +29,20 @@
#' model = "survival weibull", form = y > 100 ~ time | id / group,
#' df = df, start = c(0, 5)
#' )
#' fit1 <- fitGrowth(ss1, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit1, form = ss1$pcvrForm, df = ss1$df)
#'
#' if (rlang::is_installed("cmdstanr")) {
#' fit1 <- fitGrowth(ss1, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit1, form = ss1$pcvrForm, df = ss1$df)
#' }
#' # note that using the cumulative hazard to calculate survival is likely to underestimate
#' # survival in these plots if events do not start immediately.
#' ss2 <- growthSS(
#' model = "survival binomial", form = y > 100 ~ time | id / group,
#' df = df, start = c(-4, 3)
#' )
#' fit2 <- fitGrowth(ss2, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit2, form = ss2$pcvrForm, df = ss2$df)
#' if (rlang::is_installed("cmdstanr")) {
#' fit2 <- fitGrowth(ss2, iter = 600, cores = 2, chains = 2, backend = "cmdstanr")
#' brmSurvPlot(fit2, form = ss2$pcvrForm, df = ss2$df)
#' }
#' }
#'
#' @return Returns a ggplot showing a brms model's credible
Expand Down
13 changes: 7 additions & 6 deletions R/brmViolin.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
#' list("A" = 130, "B" = 10, "C" = 3),
#' df = simdf, type = "brms"
#' )
#'
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' brmViolin(fit, ss, ".../A_groupd > 1.05") # all groups used
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupd - B_groupd))) > 0.05") # rather arbitrary
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupa - B_groupd))) > 0.05") # totally arbitrary
#' brmViolin(fit, ss, "A_groupa/A_groupd > 1.05") # only these two groups
#' if (rlang::is_installed("cmdstanr")) {
#' fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
#' brmViolin(fit, ss, ".../A_groupd > 1.05") # all groups used
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupd - B_groupd))) > 0.05") # rather arbitrary
#' brmViolin(fit, ss, "abs(1 - ((...)/(C_groupa - B_groupd))) > 0.05") # totally arbitrary
#' brmViolin(fit, ss, "A_groupa/A_groupd > 1.05") # only these two groups
#' }
#' }
#'
#' @return Returns a ggplot showing a brms model's posterior distributions
Expand Down
24 changes: 13 additions & 11 deletions R/combineDraws.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#' the objects, or if models have different formulations.
#' @keywords brms
#' @importFrom methods is
#' @importFrom rlang is_installed
#' @returns A data.frame of posterior draws, labeled to show which object they come from.
#' @details
#' If you fit models as part of a loop/apply function and end up with a list of models it may be
Expand Down Expand Up @@ -67,18 +68,19 @@
#' ), type = "brms"
#' )
#'
#' if (rlang::is_installed("cmdstanr")) {
#' fit_ab <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1000)
#' fit_ab2 <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1200)
#' fit_cd <- fitGrowth(ss_cd, chains = 1, cores = 1, iter = 1000)
#' fit_ef <- fitGrowth(ss_ef, chains = 1, cores = 1, iter = 1000)
#' fit_ef2 <- fitGrowth(ss_ef2, chains = 1, cores = 1, iter = 1000)
#'
#' fit_ab <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1000)
#' fit_ab2 <- fitGrowth(ss_ab, chains = 1, cores = 1, iter = 1200)
#' fit_cd <- fitGrowth(ss_cd, chains = 1, cores = 1, iter = 1000)
#' fit_ef <- fitGrowth(ss_ef, chains = 1, cores = 1, iter = 1000)
#' fit_ef2 <- fitGrowth(ss_ef2, chains = 1, cores = 1, iter = 1000)
#'
#' x <- combineDraws(fit_ab, fit_cd, fit_ef)
#' draws_ef <- as.data.frame(fit_ef)
#' draws_ef <- draws_ef[, grepl("^b_", colnames(draws_ef))]
#' x2 <- combineDraws(fit_ab2, fit_cd, draws_ef)
#' x3 <- combineDraws(fit_ab, fit_cd, fit_ef2)
#' x <- combineDraws(fit_ab, fit_cd, fit_ef)
#' draws_ef <- as.data.frame(fit_ef)
#' draws_ef <- draws_ef[, grepl("^b_", colnames(draws_ef))]
#' x2 <- combineDraws(fit_ab2, fit_cd, draws_ef)
#' x3 <- combineDraws(fit_ab, fit_cd, fit_ef2)
#' }
#' }
#'
#' @return Returns a dataframe of posterior draws.
Expand Down
8 changes: 0 additions & 8 deletions R/growthSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,6 @@
#' lapply(ss, class)
#' ss$initfun()
#' # the next step would typically be compiling/fitting the model
#' # here we use very few chains and very few iterations for speed, but more of both is better.
#' \donttest{
#' fit_test <- fitGrowth(ss,
#' iter = 500, cores = 1, chains = 1, backend = "cmdstanr",
#' control = list(adapt_delta = 0.999, max_treedepth = 20)
#' )
#' }
#'
#'
#' # formulas and priors will look different if there is only one group in the data
#'
Expand Down
14 changes: 7 additions & 7 deletions R/mvSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#' optionally with a plot of simulated growth curves using draws from those priors.
#' @seealso \link{fitGrowth} for fitting the model specified by this list.
#' @examples
#' \donttest{
#' set.seed(123)
#' mv_df <- mvSim(dists = list(rnorm = list(mean = 100, sd = 30)), wide = FALSE)
#' mv_df$group <- rep(c("a", "b"), times = 900)
Expand All @@ -34,11 +35,11 @@
#' model = "linear", form = label | value ~ group, df = mv_df,
#' start = list("A" = 5), type = "brms", spectral_index = "none"
#' )
#' \donttest{
#' mod1 <- fitGrowth(ss1, backend = "cmdstanr", iter = 1000, chains = 1, cores = 1)
#' growthPlot(mod1, ss1$pcvrForm, df = ss1$df)
#' library(ggplot2)
#' ggplot() + stat_brms_model(fit = mod1, ss = ss1)
#' if (rlang::is_installed("cmdstanr")) {
#' mod1 <- fitGrowth(ss1, backend = "cmdstanr", iter = 1000, chains = 1, cores = 1)
#' growthPlot(mod1, ss1$pcvrForm, df = ss1$df)
#' library(ggplot2)
#' ggplot() + stat_brms_model(fit = mod1, ss = ss1)
#' }
#'
#' # when the model is longitudinal the same model is possible with growthSS
Expand Down Expand Up @@ -97,8 +98,7 @@
#' }
#' }))
#'
#' \donttest{
#' if (rlang::is_installed("mnormt")) {
#' if (rlang::is_installed(c("cmdstanr", "mnormt"))) {
#' m2 <- fitGrowth(ss_mv1, backend = "cmdstanr", iter = 1000, chains = 1, cores = 1)
#' growthPlot(m2, ss_mv1$pcvrForm, df = ss_mv1$df)
#' }
Expand Down
8 changes: 4 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pcvr 1.3.1
# pcvr 1.4.1

## R CMD check results

0 errors ✔ | 0 warnings ✔ | 2 notes ✖
0 errors ✔ | 0 warnings ✔ | 1 notes ✖

❯ checking CRAN incoming feasibility ... [4s/6s] NOTE
Maintainer: ‘Josh Sumner <jsumner@danforthcenter.org>’
Expand All @@ -15,14 +15,14 @@
Suggests or Enhances not in mainstream repositories:
cmdstanr
Availability using Additional_repositories specification:
cmdstanr yes https://mc-stan.org/r-packages/
cmdstanr yes https://stan-dev.r-universe.dev
❯ checking package namespace information ... OK
❯ checking package dependencies ... NOTE
Package suggested but not available for checking: ‘cmdstanr’

## Notes

Resubmitting due to large changes in the development version.
Resubmitting due to an error on cran when cmdstanr failed to install in testing.

No notes seem critical.
Names (PlantCV, Kruschke) and words (phenotyping) in DESCRIPTION are not misspelled.
Expand Down
19 changes: 10 additions & 9 deletions man/barg.Rd

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

6 changes: 4 additions & 2 deletions man/brmPlot.Rd

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

13 changes: 8 additions & 5 deletions man/brmSurvPlot.Rd

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

13 changes: 7 additions & 6 deletions man/brmViolin.Rd

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

23 changes: 12 additions & 11 deletions man/combineDraws.Rd

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

8 changes: 0 additions & 8 deletions man/growthSS.Rd

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

Loading
Loading