View source: R/PLSroundingFits.R
PLSroundingFits  R Documentation 
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
.
PLSroundingFits( data, freqVar = NULL, roundBase = 3, hierarchies = NULL, formula = NULL, dimVar = NULL, preAggregate = is.null(freqVar), xReturn = FALSE, extend0 = TRUE, limit = 1e10, viaQR = FALSE, iter = 1000, eps = 0.01, tol = 1e13, reduceBy0 = TRUE, reduceByColSums = TRUE, reduceByLeverage = FALSE, ... )
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 
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
.
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 ( 
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")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.