Skip to content

Commit

Permalink
touchups for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Aug 16, 2024
1 parent 4a24223 commit 18952c8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export(SimFunctions)
export(SimResults)
export(SimShiny)
export(SimSolve)
export(addMissing)
export(add_missing)
export(aggregate_simulations)
export(bias)
Expand Down
6 changes: 3 additions & 3 deletions R/SFA.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#'
#' sim <- runSimulation(design=Design, replications=10,
#' generate=Generate, analyse=Analyse,
#' summarise=Summarise, store_results=TRUE,
#' summarise=Summarise, store_results=TRUE, save=FALSE,
#' progress=FALSE, control=list(print_RAM=FALSE))
#' sim
#'
Expand Down Expand Up @@ -128,7 +128,7 @@
#'
#' sim2 <- runSimulation(design=Design, replications=100,
#' generate=Generate, analyse=Analyse,
#' summarise=Summarise, store_results=TRUE,
#' summarise=Summarise, store_results=TRUE, save=FALSE,
#' progress=FALSE, control=list(print_RAM=FALSE))
#' sim2
#' sum(sim2$REPLICATIONS) # more replications in total
Expand Down Expand Up @@ -168,7 +168,7 @@
#'
#' sim3 <- runSimulation(design=Design, replications=50,
#' generate=Generate, analyse=Analyse,
#' summarise=Summarise, store_results=TRUE,
#' summarise=Summarise, store_results=TRUE, save=FALSE,
#' progress=FALSE, control=list(print_RAM=FALSE))
#' sim3
#' sum(sim3$REPLICATIONS)
Expand Down
2 changes: 1 addition & 1 deletion R/addMissing.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#' Carlo simulation. \code{Journal of Statistics Education, 24}(3), 136-156.
#' \doi{10.1080/10691898.2016.1246953}
#'
#' @export add_missing
#' @export
#'
#' @author Phil Chalmers \email{rphilip.chalmers@@gmail.com}
#'
Expand Down
6 changes: 3 additions & 3 deletions R/bootPredict.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
#' }
#'
#' Summarise <- function(condition, results, fixed_objects) {
#' ret <- c(mu_bias = bias(results[,1], 0),
#' mu_coverage = ECR(results[,2:3], parameter = 0))
#' ret <- c(mu_bias = bias(results[,"mean"], 0),
#' mu_coverage = ECR(results[,c("lower", "upper")], parameter = 0))
#' ret
#' }
#'
Expand Down Expand Up @@ -103,7 +103,7 @@
#' (beta / .001)^2
#' }
#'
bootPredict <- function(condition, generate, analyse, summarise, fixed_objects, ...,
bootPredict <- function(condition, generate, analyse, summarise, fixed_objects=NULL, ...,
Rstar = seq(100, 500, by=100), boot_draws = 1000){
replications <- max(Rstar)
results <- runSimulation(design=condition, generate=generate, analyse=analyse,
Expand Down
2 changes: 1 addition & 1 deletion R/reSummarise.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#' res2 <- reSummarise(Summarise2, dir = 'simresults/')
#' res2
#'
#' SimClean('simresults/')
#' SimClean(dir='simresults/')
#'
#' }
#'
Expand Down
6 changes: 2 additions & 4 deletions R/summary_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1028,10 +1028,8 @@ ECR <- function(CIs, parameter, tails = FALSE, CI_width = FALSE,
if(is.data.frame(parameter)) parameter <- unlist(parameter)
stopifnot(is.vector(parameter))
if(length(parameter) != 1L) stopifnot(length(parameter) == nrow(CIs))
if(CIs[1,1] > CIs[1,2]){
warning('First column not less than second. Temporarily switching')
CIs <- cbind(CIs[,2L], CIs[,1L])
}
if(any(CIs[,1] > CIs[,2]))
stop('lower CIs higher than upper CIs. Please inspect')
if(CI_width){
ret <- mean(CIs[,2L] - CIs[,1L])
if(!is.null(names))
Expand Down
6 changes: 3 additions & 3 deletions man/SFA.Rd

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

6 changes: 3 additions & 3 deletions man/bootPredict.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/reSummarise.Rd

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

0 comments on commit 18952c8

Please sign in to comment.