ThError: Detection of 1000-error

ThErrorR Documentation

Detection of 1000-error

Description

Detects units with possible 1000-error by comparing values in period t with revised values from period t-1

Usage

ThError(data, id, x1, x2, ll = -2.5, ul = 2.5)

Arguments

data

Input data set of class data.frame.

id

Name of identification variable.

x1

Name of variable in period t.

x2

Name of variable in period t-1.

ll

Lower limit of log10(x1/x2) = log10(x1) - log10(x2). Default -2.5

ul

Upper limit of log10(x1/x2) = log10(x1) - log10(x2). Default +2.5

Value

Output of ThError is a data set of class data.frame. Thousand Error is only checked if both x1 and x2 are not missing and not zero. The variables are:

id

The input identification variable.

x1

The input x1 variable

x2

The input x2 variable

outlier

A binary (1/0) variable indicating whether the we suspect a 1000 error or not

diffLog10

The difference log10(x1) - log10(x2)

lowerLimit

The input parameter ll

upperLimit

The input parameter ul

Author(s)

Magnar Lillegård

References

Datarevisjon: Kontroll, granskning og retting av data. Anbefalt praksis, Statistisk sentralbyrås håndbøker, 2005/84.

Examples

 minedata <- KostraData("testdata")
 minedata$areal_381_eier_2015[c(1, 4, 5)] <- 1000 * minedata$areal_381_eier_2015[c(1, 4, 5)]
 ThError(data = minedata, id = "Region", x1 = "areal_381_eier_2015", x2 = "areal_381_eier_2014")
 ThError(data = minedata, id = "Region", x1 = "areal_381_eier_2015", x2 = "areal_381_eier_2014",
         ll = -2, ul = 2)


statisticsnorway/Kostra documentation built on Nov. 2, 2024, 6:40 p.m.