Skip to content

Commit

Permalink
Strata as factor in svydesign
Browse files Browse the repository at this point in the history
  • Loading branch information
richardli committed Apr 8, 2024
1 parent 4870fef commit 8d296ee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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= "[email protected]", role = c("cre","aut")),
person(given = "Bryan D", family = "Martin", email= "[email protected]", role = "aut"),
Expand Down
2 changes: 2 additions & 0 deletions R/countrySummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions R/fitspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion man/smoothSurvey.Rd

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

0 comments on commit 8d296ee

Please sign in to comment.