Round2: Small count rounding by various methods

View source: R/Round2.R

Round2R Documentation

Small count rounding by various methods

Description

Run makeroundtabs() or RoundViaDummy2()

Usage

Round2(data, control, ..., method = c("roundtabs", "viadummy", "viadummyAll"))

Arguments

data

Input data.frame. Same as input parameter A to makeroundtabs()

control

As input to makeroundtabs()

...

Other paramameters as input to makeroundtabs()

method

One of "roundtabs" (default), "viadummy", "viadummyAll" (allTerms=TRUE)

Value

Output from makeroundtabs or RoundViaDummy2

See Also

RoundKostra (SSB internal), RoundViaDummy, Lists2formula, MakeControl, FindMaxDiff

Examples

## Not run: 
z <- SmallCountData("sosialFiktiv")
d <- list(c("region","mnd") , c("hovedint","mnd2") , c("fylke","hovedint","mnd2") , 
          c("kostragr","hovedint","mnd"))
con <- MakeControl(d,z)
sor <- names(z)[c(4,5,3,2,1)]

roundedA <-  Round2(data=z,b=3,d=d,micro=FALSE,sort=sor,control=con, nin="ant",nout="Rndtall",
                    minit=2,maxit=10,maxdiff=5,seed=123,method="roundtabs")
roundedB <-  Round2(data=z,b=3,d=d,micro=FALSE,sort=sor,control=con, nin="ant",nout="Rndtall",
                    minit=2,maxit=10,maxdiff=5,seed=123,method="viadummy")
#10 rows of rounded data
roundedA$Ar[1:10,]  #"roundtabs"
cbind(z,roundedB$yInner)[1:10,] #"viadummy"

# recalculate maxdiff  nMaxdiff
dA <- FindMaxDiff(roundedA$Ar,con,"ant","m")
dB <- FindMaxDiff(z,con,roundedB$yInner[,1],roundedB$yInner[,2])

# Formula from d and control
Lists2formula(d,con,z)

# Formula from another d
d2 <-list(sor)
Lists2formula(d2,con,z)
Lists2formula(d2,con) # Without knowing data
Lists2formula(d2,data=z) # Without control
Lists2formula(d2,data=z) # Without control and data

## End(Not run)

SmallCountRounding documentation built on Nov. 16, 2022, 5:11 p.m.