| PLSroundingFits {SmallCountRounding} | R Documentation | 
Small count rounding with post-processing to expected frequencies
Description
The counts rounded by PLSrounding
Thereafter, based on the publishable rounded data, expected inner cell frequencies are generated by iterative proportional fitting using Mipf.
To ensure that empty cells missing in input data are included in the fitting process, the data is first extended using Extend0.
Usage
PLSroundingFits(
  data,
  freqVar = NULL,
  roundBase = 3,
  hierarchies = NULL,
  formula = NULL,
  dimVar = NULL,
  preAggregate = is.null(freqVar),
  xReturn = FALSE,
  extend0 = TRUE,
  limit = 1e-10,
  viaQR = FALSE,
  iter = 1000,
  eps = 0.01,
  tol = 1e-13,
  reduceBy0 = TRUE,
  reduceByColSums = TRUE,
  reduceByLeverage = FALSE,
  ...
)
Arguments
data | 
 data frame (inner cells)  | 
freqVar | 
 Variable holding counts  | 
roundBase | 
 Rounding base  | 
hierarchies | 
 List of hierarchies  | 
formula | 
 Model formula  | 
dimVar | 
 Dimensional variables  | 
preAggregate | 
 Aggregation  | 
xReturn | 
 Dummy matrix in output when   | 
extend0 | 
 Data is automatically extended by   | 
limit | 
 
  | 
viaQR | 
 
  | 
iter | 
 
  | 
eps | 
 
  | 
tol | 
 
  | 
reduceBy0 | 
 
  | 
reduceByColSums | 
 
  | 
reduceByLeverage | 
 
  | 
... | 
 Further parameters to   | 
Details
The seven first parameters is documented in more detail in PLSrounding.
If iterative proportional fitting succeeds, the maximum difference between rounded counts and ipFit is less than input parameter eps.
Value
Output from PLSrounding (class attribute "PLSrounded") with modified versions of inner and publish:
inner | 
 Extended with more input data variables and with expected frequencies (  | 
publish | 
 Extended with aggregated expected frequencies (  | 
Examples
z <- data.frame(geo  = c("Iceland", "Portugal", "Spain"), 
                eu = c("nonEU", "EU", "EU"),
                year = rep(c("2018","2019"), each = 3),
                freq = c(2,3,7,1,5,6), stringsAsFactors = FALSE)
z4 <- z[-c(1:2), ]
PLSroundingFits(z4, "freq", formula = ~eu * year + geo, extend0 = FALSE)[c("inner", "publish")]
PLSroundingFits(z4, "freq", formula = ~eu * year + geo)[c("inner", "publish")]
my_km2 <- SSBtools::SSBtoolsData("my_km2")
# Default automatic extension (extend0 = TRUE)
PLSroundingFits(my_km2, "freq", 
       formula = ~(Sex + Age) * Municipality * Square1000m + Square250m)[c("inner", "publish")]
# Manual specification to avoid Nittedal combined with another_km
PLSroundingFits(my_km2, "freq", formula = ~(Sex + Age) * Municipality * Square1000m + Square250m, 
       extend0 = list(c("Sex", "Age"), 
       c("Municipality", "Square1000m", "Square250m")))[c("inner", "publish")]