Skip to content

Commit

Permalink
Merge 84da895 into 1c2ec7c
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhard-da committed Sep 18, 2020
2 parents 1c2ec7c + 84da895 commit 78885c7
Show file tree
Hide file tree
Showing 11 changed files with 226 additions and 364 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Expand Up @@ -64,7 +64,6 @@ Collate:
'groupAndRename.R'
'GUIfunctions.R'
'indivRisk.R'
'LLmodGlobalRisk.R'
'LocalRecProg.R'
'localSupp.R'
'localSuppression.R'
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Expand Up @@ -15,7 +15,6 @@ S3method(summary,freqCalc)
S3method(summary,micro)
S3method(summary,pram)
export("strataVar<-")
export(LLmodGlobalRisk)
export(LocalRecProg)
export(addGhostVars)
export(addNoise)
Expand Down Expand Up @@ -120,6 +119,7 @@ importFrom(stats,lm)
importFrom(stats,mad)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(stats,terms)
importFrom(stats,var)
Expand Down
25 changes: 19 additions & 6 deletions R/0classes.r
Expand Up @@ -44,6 +44,7 @@
#' @importFrom stats sd
#' @importFrom stats terms
#' @importFrom stats var
#' @importFrom stats runif
#' @importFrom utils data
setClassUnion("dataframeOrNULL", c("data.frame", "NULL"))
setClassUnion("numericOrNULL", c("numeric", "NULL"))
Expand Down Expand Up @@ -136,19 +137,31 @@ setClassUnion("sdcmicroOrNULL", c("NULL"))
#' sdc <- topBotCoding(sdc, value=60000000, replacement=62000000, column="income")
#' head(get.sdcMicroObj(sdc, type="manipNumVars"))
#' sdc@@risk$numeric
#'
#' ### LocalRecProg
#' data(testdata2)
#' keyVars <- c("urbrur", "roof", "walls", "water", "sex")
#' w <- "sampling_weight"
#' sdc <- createSdcObj(testdata2,
#' keyVars=c("urbrur", "roof", "walls", "water", "sex", "relat"))
#' keyVars = keyVars,
#' weightVar = w)
#' sdc@@risk$global
#' sdc <- LocalRecProg(sdc)
#' sdc@@risk$global
#' ### LLmodGlobalRisk
#' sdc <- undolast(sdc)
#' sdc <- LLmodGlobalRisk(sdc, inclProb=0.001)
#' sdc@@risk$model
#' ### model-based risks
#' #' formula
#' form <- as.formula(paste("~", paste(keyVars, collapse = "+")))
#' sdc <- modRisk(sdc, method = "default", formulaM = form)
#' get.sdcMicroObj(sdc, "risk")$model
#' sdc <- modRisk(sdc, method = "CE", formulaM = form)
#' get.sdcMicroObj(sdc, "risk")$model
#' sdc <- modRisk(sdc, method = "PLM", formulaM = form)
#' get.sdcMicroObj(sdc, "risk")$model
#' sdc <- modRisk(sdc, method = "weightedLLM", formulaM = form)
#' get.sdcMicroObj(sdc, "risk")$model
#' sdc <- modRisk(sdc, method = "IPF", formulaM = form)
#' get.sdcMicroObj(sdc, "risk")$model
#' }
#'
setClass(Class = "sdcMicroObj",
representation = representation(
origData = "dataframeOrNULL",
Expand Down
152 changes: 0 additions & 152 deletions R/LLmodGlobalRisk.R

This file was deleted.

10 changes: 5 additions & 5 deletions R/aux_functions.r
Expand Up @@ -338,11 +338,11 @@ setMethod(f="calcRisksX", signature=c("sdcMicroObj"), definition=function(obj, .
suda2Set <- (!is.null(risk$suda2))
obj <- measure_risk(obj)
if (modelSet) {
inclProb <- NULL
if (!is.null(risk$model$inclProb)) {
inclProb <- risk$model$inclProb
}
obj <- LLmodGlobalRisk(obj, inclProb=inclProb)
kv <- colnames(get.sdcMicroObj(obj, type = "manipKeyVars"))
obj <- modRisk(
obj = obj,
method = "IPF",
formulaM = as.formula(paste(" ~ ", paste(kv, collapse="+"))))
}
if (suda2Set) {
obj <- suda2(obj)
Expand Down

0 comments on commit 78885c7

Please sign in to comment.