Learn R Programming

sms (version 2.3.1)

find_best_selection: find_best_selection

Description

Find the best selection of individual records for a census area.

Usage

find_best_selection(area, insms, inseed = -1)

Arguments

area
A census area
insms
A microsimulation object which holds the data and details of the simulation such as iterations, lexicon.
inseed
test

Value

list A list with results (#areaid, #selection, #tae, #tries, #error_states).

Details

Calculate the best area representation, after a series of selection tries.

Examples

Run this code
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"))

this_area=as.data.frame(census[1,]) #Select the first area from the census table
insms= new("microsimulation",census=census,panel=survey, lexicon=in.lexicon, iterations=10)
best=find_best_selection(this_area, insms)
print(best)

Run the code above in your browser using DataLab