|
130 | 130 | #' @param winebin If you are trying to use our MCDS.exe optimizer on a |
131 | 131 | #' non-windows system then you may need to specify the winebin. Please |
132 | 132 | #' see [`mcds_dot_exe`][mrds::mcds_dot_exe] for more details. |
| 133 | +#' @param conf_level level of confidence used in computations of confidence interval width: |
| 134 | +#' default 0.95, must be between 0 and 1 |
| 135 | +#' @param alpha provides an alternative way to specify `conf_level`. If `alpha` is specified |
| 136 | +#' then `conf_level` is set to 1-`alpha`. (This takes precedence over whatever value is given |
| 137 | +#' to `conf_level`.) |
133 | 138 | #' @param dht.group deprecated, see same argument with underscore, above. |
134 | 139 | #' @param region.table deprecated, see same argument with underscore, above. |
135 | 140 | #' @param sample.table deprecated, see same argument with underscore, above. |
@@ -340,6 +345,8 @@ ds <- function(data, truncation=ifelse(is.null(data$distend), |
340 | 345 | initial_values=NULL, max_adjustments=5, er_method=2, dht_se=TRUE, |
341 | 346 | optimizer = "both", |
342 | 347 | winebin = NULL, |
| 348 | + conf_level = 0.95, |
| 349 | + alpha, |
343 | 350 | # deprecated below here: |
344 | 351 | dht.group, |
345 | 352 | region.table, |
@@ -531,6 +538,14 @@ ds <- function(data, truncation=ifelse(is.null(data$distend), |
531 | 538 | stop("Cannot supply initial values when using AIC term selection") |
532 | 539 | } |
533 | 540 |
|
| 541 | + # check conf_level |
| 542 | + if(!((conf_level >= 0) | (conf_level <= 1))) stop("Option conf_level is not in the range 0-1") |
| 543 | + # set conf_level if alpha specified |
| 544 | + if(!missing(alpha)){ |
| 545 | + if(!((alpha >= 0) | (alpha <= 1))) stop("Option alpha is not in the range 0-1") |
| 546 | + conf_level <- 1 - alpha |
| 547 | + } |
| 548 | + |
534 | 549 | ### Actually fit some models here |
535 | 550 |
|
536 | 551 | # construct the meta data object... |
@@ -731,7 +746,8 @@ ds <- function(data, truncation=ifelse(is.null(data$distend), |
731 | 746 | dht_options <- list(group = dht_group, |
732 | 747 | ervar = er_var, |
733 | 748 | varflag = er_method, |
734 | | - convert.units = convert_units) |
| 749 | + convert.units = convert_units, |
| 750 | + ci.width = conf_level) |
735 | 751 |
|
736 | 752 | # if no obs_table |
737 | 753 | if(is.null(obs_table)){ |
|
0 commit comments