11  Final Weight Diagnostics

In this section, we will visualize the distributions of weights at each stage of the weighting process for households, persons, days, trips, and linked trips. This will help us understand how the weights change through each round of weighting and identify any potential issues.

Load Data and Settings

# Load the Local Package for Development
if (requireNamespace("devtools", quietly = TRUE)) {
    devtools::load_all()
}

settings     = get_settings(reload_settings = TRUE, print = FALSE)

# Extract Commonly Used Paths and Labels from Settings
code_root    = get("code_root",    settings)
work_dir     = get("working_dir",  settings)
inputs_dir   = get("inputs_dir",   settings)
outputs_dir  = get("outputs_dir",  settings)
report_dir   = get("report_dir",   settings)

households   = readRDS(file.path(work_dir, "households_survey_imputed.rds"))
persons      = readRDS(file.path(work_dir, "persons_survey_imputed.rds"))
days         = fetch_hts_table("day",         settings)
trips        = fetch_hts_table("trip",        settings)
linked_trips = fetch_hts_table("linked_trip", settings)

hh_weights = fread(file.path(outputs_dir, "hh_weights.csv"),
  colClasses = c(
    "hh_id" = "character"
  )
)

person_weights = fread(file.path(outputs_dir, "person_weights.csv"),
  colClasses = c(
    "person_id" = "character",
    "hh_id" = "character"
  )
)

day_weights = fread(file.path(outputs_dir, "day_weights.csv"),
  colClasses = c(
    "day_id" = "character",
    "person_id" = "character",
    "hh_id" = "character"
  )
)

trip_weights = fread(file.path(outputs_dir, "trip_weights.csv"),
  colClasses = c(
    "trip_id" = "character",
    "day_id" = "character",
    "person_id" = "character",
    "hh_id" = "character"
  )
)

linked_trip_weights = fread(file.path(outputs_dir, "linked_trip_weights.csv"),
  colClasses = c(
    "linked_trip_id" = "character",
    "day_id" = "character",
    "person_id" = "character",
    "hh_id" = "character"
  )
)
Weight Distributions by Weighting Round. Each point represents a single weight. Zero weights are excluded. The y-axis is on a log scale to better visualize the distribution of weights.

The table below shows summary statistics for the weights at each stage of the weighting process.

Weight Summary Statistics by Weighting Round and Type

type

weight_round

min

median

mean

max

sd

cv_w

deff_w

n

sum_w

n_eff_cv

n_eff_kish

Household

Round 1

18.147260

260.2949

600.3451

7,999.746

967.5737

1.611696

3.597564

2,910

1,747,004

808.8807

809.0815

Household

Round 2

18.215294

220.9674

600.8398

7,986.562

1,023.2158

1.702976

3.900127

2,910

1,748,444

746.1295

746.3202

Household

Round 3

0

0

Household

Final Weight

18.215294

220.9674

600.8398

7,986.562

1,023.2158

1.702976

3.900127

2,910

1,748,444

746.1295

746.3202

Person

Round 1

18.147260

275.2027

702.1873

7,999.746

1,150.2471

1.638091

3.683344

6,037

4,239,105

1,639.0000

1,639.1978

Person

Round 2

18.215294

231.1756

702.0175

7,986.562

1,198.5152

1.707244

3.914682

6,037

4,238,080

1,542.1431

1,542.3334

Person

Round 3

0

0

Person

Final Weight

18.215294

231.1756

702.0175

7,986.562

1,198.5152

1.707244

3.914682

6,037

4,238,080

1,542.1431

1,542.3334

Day

Round 1

5.193027

174.2293

559.3963

7,999.746

1,045.8255

1.869561

4.495259

7,578

4,239,105

1,685.7762

1,685.9492

Day

Round 2

5.224544

160.5288

559.2610

7,986.562

1,076.8593

1.925504

4.707566

7,578

4,238,080

1,609.7491

1,609.9165

Day

Round 3

0

0

Day

Final Weight

5.224544

160.5288

559.2610

7,986.562

1,076.8593

1.925504

4.707566

7,578

4,238,080

1,609.7491

1,609.9165

Trip

Round 1

5.193027

169.6110

541.8296

7,999.746

1,016.0150

1.875156

4.516210

24,693

13,379,398

5,467.6373

5,467.8097

Trip

Round 2

5.224544

165.0728

582.6478

7,986.562

1,098.2761

1.884974

4.553128

24,693

14,387,322

5,423.3047

5,423.4761

Trip

Round 3

5.224544

209.3988

743.8786

12,192.696

1,431.0068

1.923710

4.700660

26,373

19,618,312

5,610.4885

5,610.6560

Trip

Final Weight

5.224544

209.3988

743.8786

12,192.696

1,431.0068

1.923710

4.700660

26,373

19,618,312

5,610.4885

5,610.6560

Linked Trip

Round 1

5.193027

171.6809

557.3531

7,999.746

1,037.3614

1.861228

4.464170

23,377

13,029,244

5,236.5835

5,236.7573

Linked Trip

Round 2

5.224544

167.8696

599.1535

7,986.562

1,121.3623

1.871578

4.502803

23,377

14,006,411

5,191.6547

5,191.8274

Linked Trip

Round 3

5.224544

209.4542

773.6256

12,192.696

1,487.5430

1.922820

4.697238

23,377

18,085,046

4,976.7547

4,976.9223

Linked Trip

Final Weight

5.224544

209.4542

773.6256

12,192.696

1,487.5430

1.922820

4.697238

23,377

18,085,046

4,976.7547

4,976.9223