Skip to content

Commit

Permalink
fixing cran problems
Browse files Browse the repository at this point in the history
  • Loading branch information
joshyam-k committed Feb 12, 2024
1 parent e9a5455 commit 3850820
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 5 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Authors@R: c(person("Josh", "Yamamoto", role = c("aut", "cre"),
person("Kate", "Hu", role = "aut"))
Maintainer: Josh Yamamoto <joshuayamamoto5@gmail.com>
Description: Simplifies the process of fitting a zero-inflated estimator
onto a dataset.
onto a dataset. This estimator is a combination of a linear mixed effects regression model
and a logistic mixed effects regression model which is summarized by White et al (2024, <arXiv:2402.03263>).
The variance is estimated through a parametric bootstrapping method which is given
by Chandra et al (2012, <doi:10.1080/03610918.2011.598991>).
License: CC0
Encoding: UTF-8
LazyData: true
Expand Down
38 changes: 34 additions & 4 deletions R/saeczi.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,39 @@
#'
#' @details The arguments `lin_formula`, and `log_formula`
#' can be unquoted or quoted. The function can handle both forms.
#'
#'
#' The two datasets (pop_dat and samp_dat) must have the same column names for the domain level,
#' as well as the predictor variables for the function to work.
#'
#' @returns
#' An object of class `zi_mod` with defined `print()` and `summary()` methods.
#' The object is structured like a list and contains the following elements:
#'
#' * call: The original function call
#'
#' * res: A data.frame containing the estimates and mse estimates
#'
#' * bootstrap_log: A list containing any messages and warnings that occur during the bootstrap process
#'
#' * lin_mod: The modeling object used to fit the original linear model
#'
#' * log_mod: The modeling object used to fit the original logistic model
#'
#' @examples
#' data(pop)
#' data(samp)
#'
#' lin_formula <- DRYBIO_AG_TPA_live_ADJ ~ tcc16 + elev
#'
#' result <- saeczi(samp,
#' pop,
#' lin_formula,
#' log_formula = lin_formula,
#' domain_level = "COUNTYFIPS",
#' mse_est = TRUE,
#' B = 5,
#' parallel = FALSE)
#'
#' @export saeczi
#' @import stats
#' @importFrom progressr progressor with_progress
Expand Down Expand Up @@ -266,7 +296,7 @@ saeczi <- function(samp_dat,
})

} else {

res <-
purrr::map(.x = boot_samp_ls,
.f = \(.x) {
Expand All @@ -279,7 +309,7 @@ saeczi <- function(samp_dat,
type = "iterator",
clear = TRUE
))

beta_lm_mat <- res |>
map_dfr(.f = ~ .x$params$beta_lm) |>
as.matrix()
Expand Down Expand Up @@ -342,7 +372,7 @@ saeczi <- function(samp_dat,
bootstrap_log <- NA

}


out <- list(
call = funcCall,
Expand Down
30 changes: 30 additions & 0 deletions man/saeczi.Rd

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

0 comments on commit 3850820

Please sign in to comment.