Description Usage Arguments Value Examples
Compute error probabilities according to the error model and units ordered by priority
1 2 3 4 | computeProbs(object, na.as.category)
## S4 method for signature 'categObsPredModelParam,logical'
computeProbs(object, na.as.category = FALSE)
|
object |
Object of class categObsPredModelParam. |
na.as.category |
logical with default to |
A categObsPredModelParam with the new slot probs with the following columns:
Identification variables for each unit in the input data set
One per regressor
Error probabilities
The priority based on error probabilities for each of units
Error moments
The priority based on error moments for each of units
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
object <- readRDS("R:/USIE/Proyecto_DepSel_VarQual/categ_RF_simulacion/PC/RDS/ObsPredPar1.rds")
poolDD <- getDD(object@Data)
regressors <- getRegressors(object)
targetVars <- getRegressands(object)
id.vars <- object@VarRoles$Units
vars <- c(id.vars,targetVars,regressors)
data.dt <- object@Test$data
data.dt[c(1:3,10:16), NivelEstudios_35._2.1.4.:= NA ]
data.dt[c(4:7,17:22), Edad_05._2.1.5.1.:= NA]
# Provocamos un nivel distinto en "SitEmpleo_35._2.1.5.1._"
data.dt[c(30:49), SitEmpleo_35._2.1.5.1._ := rep(c('8', '9'), 10)]
data.dt[c(23:35), Sexo_04._2.1.5.1. := '4']
data.StQ <- melt_StQ(data.dt[,..vars], poolDD)
object@Data <- data.StQ
object2 <- computeProbs(object)
# Dividimos el conjunto de datos en tres:
# (i) con missing en alguna variable numérica,
# (ii) con niveles nuevos en alguna variable categórica
# (iii) el resto, donde se imputa NAs a valor *
# (i) y (ii) se imputan probError a 1
# (iii) se aplica el modelo ajustado y se computan probabilidades
# Se vuelven a combinar los datsets y se computan momentos de error y prioridades
# Provocamos missing en "NivelEstudios_35._2.1.4." y "Edad_05._2.1.5.1."
currentData.dt[c(1:3,10:16), NivelEstudios_35._2.1.4.:=NA]
currentData.dt[c(4:7,17:22), Edad_05._2.1.5.1.:=NA]
# Provocamos un nivel distinto en "SitEmpleo_35._2.1.5.1._"
currentData.dt[c(30:49), SitEmpleo_35._2.1.5.1._:='8']
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.