diff --git a/DESCRIPTION b/DESCRIPTION index 84dc090..8dfa05f 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: SUMMER Type: Package Title: Small-Area-Estimation Unit/Area Models and Methods for Estimation in R -Version: 1.4.0 -Date: 2024-02-29 +Version: 1.4.1 +Date: 2024-04-07 Authors@R: c( person(given = "Zehang R", family = "Li", email= "lizehang@gmail.com", role = c("cre","aut")), person(given = "Bryan D", family = "Martin", email= "bmartin6@uw.edu", role = "aut"), diff --git a/R/countrySummary.R b/R/countrySummary.R index f2317d1..7ea3c3a 100644 --- a/R/countrySummary.R +++ b/R/countrySummary.R @@ -88,6 +88,8 @@ getDirect <- function(births, years, regionVar = "region", timeVar = "time", clu if (is.null(births$strata)) { stop("Strata not defined.") + }else{ + births$strata <- factor(births$strata) } if (is.null(clusterVar)){ stop("Cluster not defined") diff --git a/R/fitspace.R b/R/fitspace.R index f6b4f8b..31b0c30 100755 --- a/R/fitspace.R +++ b/R/fitspace.R @@ -87,7 +87,8 @@ #' head(fit0.draws$draws.est[, 1:10]) #' #' # Example with region-level covariates -#' Xmat <- aggregate(age~region, data = DemoData2, FUN = mean) +#' Xmat <- aggregate(age~region, data = DemoData2, +#' FUN = function(x) mean(x)) #' fit1 <- smoothSurvey(data=DemoData2, #' Amat=DemoMap2$Amat, responseType="binary", #' X = Xmat, @@ -372,7 +373,7 @@ smoothSurvey <- function(data, geo = NULL, Amat = NULL, region.list = NULL, X = stop("Exist regions in the data frame but not in Amat.") } data$region0 <- factor(data$region0, levels = colnames(Amat)) - data$strata0 <- data[, strataVar.within] + data$strata0 <- factor(data[, strataVar.within]) if(!is.null(clusterVar)) data$cluster0 <- data[, clusterVar] # check column names of covariates diff --git a/R/summary.R b/R/summary.R index 33b4cc5..c3b8cd8 100644 --- a/R/summary.R +++ b/R/summary.R @@ -84,8 +84,8 @@ summary.SUMMERmodel <- function(object,...){ hyperpar <- summary(object$fit)$hyperpar print(hyperpar) - neffp <- summary(object$fit)$neffp - print(neffp) + # neffp <- summary(object$fit)$neffp + # print(neffp) mlik <- summary(object$fit)$mlik print(mlik) } @@ -311,8 +311,8 @@ summary.SUMMERmodel.svy <- function(object,...){ hyperpar <- summary(object$fit)$hyperpar print(hyperpar) - neffp <- summary(object$fit)$neffp - print(neffp) + # neffp <- summary(object$fit)$neffp + # print(neffp) mlik <- summary(object$fit)$mlik print(mlik) } diff --git a/man/smoothSurvey.Rd b/man/smoothSurvey.Rd index 9d47b75..b8f5f59 100644 --- a/man/smoothSurvey.Rd +++ b/man/smoothSurvey.Rd @@ -197,7 +197,8 @@ clusterVar = "~clustid+id", CI = 0.95, save.draws = TRUE) head(fit0.draws$draws.est[, 1:10]) # Example with region-level covariates - Xmat <- aggregate(age~region, data = DemoData2, FUN = mean) + Xmat <- aggregate(age~region, data = DemoData2, + FUN = function(x) mean(x)) fit1 <- smoothSurvey(data=DemoData2, Amat=DemoMap2$Amat, responseType="binary", X = Xmat,