calculate_error: Calculate error of a selection

Description Usage Arguments Details Value Author(s) Examples

View source: R/sms.R

Description

Calculate the error of a selection.

Usage

1
calculate_error(selection, area_census, lexicon)

Arguments

selection

A population selection, to evaluate its error

area_census

An area from census (a row)

lexicon

A data.frame with details about data connections

Details

Calculates the Total Absolute Error (TAE) of a selection for a census area.

Value

TAE Total Absolute Error of this selection against the census description of this area.

Author(s)

Dimitris Kavroudakis dimitris123@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(sms)
data(survey) #load the data
data(census)
in.lexicon=createLexicon() # Create a data lexicon for holding the associated column names.
in.lexicon=addDataAssociation(in.lexicon, c("he","he"))
in.lexicon=addDataAssociation(in.lexicon, c("females","female"))

#Select the first area from the census table
this_area=as.data.frame(census[1,]) 

#make a random selection of individuals for this area.
selection=random_panel_selection( survey, this_area$population ) 

#evaluate the Total Absolute Error (TAE) for this selection
error=calculate_error( selection, this_area, in.lexicon ) 
print( error )    # print the error of the selection

sms documentation built on May 1, 2019, 8:18 p.m.