Skip to content

Commit

Permalink
cran fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattblackwell committed Apr 11, 2024
1 parent 6a60450 commit dfa3b86
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]", role = c("aut")),
Expand Down
10 changes: 5 additions & 5 deletions R/ameliagui.r
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Interactive GUI for Amelia
q#' Interactive GUI for Amelia
#'
#' @name ameliagui
#'
Expand Down Expand Up @@ -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"))))
}

Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions R/diag.r
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions R/emb.r
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/prep.r
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vignettes/intro-mi.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion vignettes/using-amelia.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dfa3b86

Please sign in to comment.