From dfa3b869da2a97cf9c17c8295438ca2b14ed3b0a Mon Sep 17 00:00:00 2001 From: Matthew Blackwell Date: Wed, 10 Apr 2024 20:41:54 -0400 Subject: [PATCH] cran fixes --- DESCRIPTION | 2 +- R/ameliagui.r | 10 +++++----- R/diag.r | 8 ++++---- R/emb.r | 6 +++--- R/prep.r | 2 +- vignettes/intro-mi.Rmd | 2 +- vignettes/using-amelia.Rmd | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e79e71b..1ddef21 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: Amelia Version: 1.8.2 -Date: 2024-03-04 +Date: 2024-04-10 Title: A Program for Missing Data Authors@R: c( person("James", "Honaker", email = "james@hona.kr", role = c("aut")), diff --git a/R/ameliagui.r b/R/ameliagui.r index 6275a30..7ab8530 100644 --- a/R/ameliagui.r +++ b/R/ameliagui.r @@ -1,4 +1,4 @@ -#' Interactive GUI for Amelia +q#' Interactive GUI for Amelia #' #' @name ameliagui #' @@ -457,7 +457,7 @@ load.session <- function() { "Re-save imputed data sets to the working directory?", icon = "question", default = "yes", type = "yesno") if (tcltk::tclvalue(resave) == "yes") { - amelia.save(getAmelia("ameliaObject"), + amelia_save(getAmelia("ameliaObject"), tcltk::tclvalue(getAmelia("outname")), as.numeric(tcltk::tclvalue(getAmelia("outnum")))) } @@ -633,7 +633,7 @@ run.amelia <- function() { "normal") tcltk::tkentryconfigure(getAmelia("main.menu.output"), 2, state = "normal") tcltk::tkconfigure(getAmelia("showLogButton"), state = "normal") - amelia.save(getAmelia("ameliaObject"), + amelia_save(getAmelia("ameliaObject"), tcltk::tclvalue(getAmelia("outname")), as.numeric(tcltk::tclvalue(getAmelia("outnum")))) tcltk::tkgrid(getAmelia("allgood.label"), row = 2, column = 7, sticky ="e", padx = 10) @@ -642,7 +642,7 @@ run.amelia <- function() { } -amelia.save <- function(out,outname,m) { +amelia_save <- function(out,outname,m) { save.type <- as.numeric(tcltk::tclvalue(getAmelia("outtype"))) if (save.type == 1) { write.amelia(out, file.stem = outname, format = "csv", @@ -2702,7 +2702,7 @@ environment(activateGUI) <- ameliaEnv environment(save.session) <- ameliaEnv environment(load.session) <- ameliaEnv environment(run.amelia) <- ameliaEnv -environment(amelia.save) <- ameliaEnv +environment(amelia_save) <- ameliaEnv environment(set.out) <- ameliaEnv environment(setTS) <- ameliaEnv environment(unsetTS) <- ameliaEnv diff --git a/R/diag.r b/R/diag.r index aaf84b4..e174278 100644 --- a/R/diag.r +++ b/R/diag.r @@ -292,7 +292,7 @@ overimpute <- function(output, var, draws = 20, subset, legend = TRUE, xlab, ## The argument list for an amelia output is now ## at "output$arguments" - prepped <- amelia.prep(x = data, arglist = output$arguments, incheck = FALSE) + prepped <- amelia_prep(x = data, arglist = output$arguments, incheck = FALSE) stacked.var <- match(var, prepped$subset.index[prepped$p.order]) subset.var <- match(var, prepped$subset.index) @@ -532,7 +532,7 @@ disperse <- function(output, m = 5, dims = 1, p2s = 0, frontend = FALSE, ..., } # prep the data and arguments - prepped<-amelia.prep(x=data, arglist=output$arguments) + prepped<-amelia_prep(x=data, arglist=output$arguments) if (p2s) cat("-- Imputation", "1", "--") if (frontend) { @@ -897,7 +897,7 @@ tscsPlot <- function(output, var, cs, draws = 100, conf = .90, par(mfcol = c(nr, nc)) } - prepped <- amelia.prep(x = data, arglist = output$arguments) + prepped <- amelia_prep(x = data, arglist = output$arguments) if (!is.null(prepped$blanks)) { data <- data[-prepped$blanks,] unit.rows <- which(csvar %in% cs) @@ -919,7 +919,7 @@ tscsPlot <- function(output, var, cs, draws = 100, conf = .90, if (sum(miss) > 0) { for (i in 1:draws) { currtheta <- output$theta[,,ceiling(i/drawsperimp)] - imps[,i] <- amelia.impute(x = cross.sec, thetareal = currtheta, + imps[,i] <- amelia_impute(x = cross.sec, thetareal = currtheta, bounds = prepped$bounds, priors = prepped$priors, max.resample = output$arguments$max.resample)[,stacked.var] diff --git a/R/emb.r b/R/emb.r index ce688ae..78375e4 100644 --- a/R/emb.r +++ b/R/emb.r @@ -270,7 +270,7 @@ emarch<-function(x,p2s=TRUE,thetaold=NULL,startvals=0,tolerance=0.0001,priors=NU } ## Draw imputations for missing values from a given theta matrix -amelia.impute<-function(x,thetareal,priors=NULL,bounds=NULL,max.resample=NULL){ +amelia_impute<-function(x,thetareal,priors=NULL,bounds=NULL,max.resample=NULL){ indx<-indxs(x) # This needs x.NA if (!identical(priors,NULL)){ @@ -771,7 +771,7 @@ amelia.default <- function(x, m = 5, p2s = 1, frontend = FALSE, idvars = NULL, am.call <- match.call(expand.dots = TRUE) archv <- am.call - prepped<-amelia.prep(x = x, m = m, idvars = idvars, empri = empri, ts = ts, + prepped<-amelia_prep(x = x, m = m, idvars = idvars, empri = empri, ts = ts, cs = cs, tolerance = tolerance, polytime = polytime, splinetime = splinetime, lags = lags, leads = leads, logs = logs, sqrts = sqrts, lgstc = lgstc, p2s = p2s, @@ -852,7 +852,7 @@ amelia.default <- function(x, m = 5, p2s = 1, frontend = FALSE, idvars = NULL, return(impdata) } - ximp <- amelia.impute(prepped$x, thetanew$thetanew, priors = prepped$priors, + ximp <- amelia_impute(prepped$x, thetanew$thetanew, priors = prepped$priors, bounds = prepped$bounds, max.resample) ximp <- amunstack(ximp, n.order = prepped$n.order, p.order = prepped$p.order) diff --git a/R/prep.r b/R/prep.r index 2f821b2..93ad15a 100644 --- a/R/prep.r +++ b/R/prep.r @@ -676,7 +676,7 @@ combine.output <- function(...) { } -amelia.prep <- function(x,m=5,p2s=1,frontend=FALSE,idvars=NULL,logs=NULL, +amelia_prep <- function(x,m=5,p2s=1,frontend=FALSE,idvars=NULL,logs=NULL, ts=NULL,cs=NULL,empri=NULL, tolerance=0.0001,polytime=NULL,splinetime=NULL,startvals=0,lags=NULL, leads=NULL,intercs=FALSE,sqrts=NULL, diff --git a/vignettes/intro-mi.Rmd b/vignettes/intro-mi.Rmd index 1ff79be..ac10da2 100644 --- a/vignettes/intro-mi.Rmd +++ b/vignettes/intro-mi.Rmd @@ -29,7 +29,7 @@ The Amelia program goes several significant steps beyond the capabilities of the Multiple imputation involves imputing $m$ values for each missing cell in your data matrix and creating $m$ "completed" data sets. Across these completed data sets, the observed values are the same, but the missing values are filled in with a distribution of imputations that reflect the uncertainty about the missing data. After imputation with Amelia's EMB algorithm, you can apply whatever statistical method you would have used if there had been no missing values to each of the $m$ data sets, and use a simple procedure, described below, to combine the results[^combine]. Under normal circumstances, you only need to impute once and can then analyze the $m$ imputed data sets as many times and for as many purposes as you wish. The advantage of Amelia is that it combines the comparative speed and ease-of-use of our algorithm with the power of multiple imputation, to let you focus on your substantive research questions rather than spending time developing complex application-specific models for nonresponse in each new data set. Unless the rate of missingness is very high, $m = 5$ (the program default) is probably adequate. -[^combine]: You can combine the results automatically by doing your data analyses within [Zelig for R](https://zeligproject.org), or within [Clarify for Stata](https://gking.harvard.edu/clarify). +[^combine]: You can combine the results automatically by doing your data analyses within [Zelig for R](https://docs.zeligproject.org/index.html), or within [Clarify for Stata](https://gking.harvard.edu/clarify). ### Assumptions diff --git a/vignettes/using-amelia.Rmd b/vignettes/using-amelia.Rmd index dfa6e4d..4b974ed 100644 --- a/vignettes/using-amelia.Rmd +++ b/vignettes/using-amelia.Rmd @@ -508,7 +508,7 @@ out <- mi.combine(imp.models, conf.int = TRUE) out ``` -The combination of the results depends on the [broom](https://broom.tidymodels.org) package and results can be combined if a `tidy()` method exists for the estimation function passed to `with()`. Other packages such as [Zelig](https://zeligproject.org) can also combine imputed data sets across a number of statistical models. Furthermore, users can easily export their imputations using the `write.amelia()` function as described in \@ref(sec_saving) and use statistical packages other than R for the analysis model. +The combination of the results depends on the [broom](https://broom.tidymodels.org) package and results can be combined if a `tidy()` method exists for the estimation function passed to `with()`. Other packages such as [Zelig](https://docs.zeligproject.org/index.html) can also combine imputed data sets across a number of statistical models. Furthermore, users can easily export their imputations using the `write.amelia()` function as described in \@ref(sec_saving) and use statistical packages other than R for the analysis model. In addition to the resources available in R, users can draw on Stata to implement their analysis models. As of version 11,