0
$\begingroup$

I think I must be performing a silly mistake in my survey design as I cannot even count the numbers of males and females in NY state. The numbers are too large:

library(survey)

# download the 2015 1-year ACS .csv file to your location
# http://www2.census.gov/programs-surveys/acs/data/pums/2015/1-Year/csv_pny.zip

# read the 2015 1-year ACS .csv file from your location
acs.p <- read.csv(file = "I:/Data/ACS - American Community Survey/PUMS/csv_pny/ss15pny.csv", 
                          header = TRUE, 
                          sep = ",")

# make the survey design
acs_svy <- svydesign(id = ~1, 
                weights = ~PWGTP,
                data = acs.p,
                repweights = "pwgtp[0-9]+",
                # type = "JK1", # "JKn",
                scale = 4/80,
                rscales = rep(1,80),
                mse = TRUE,
                combined.weights = TRUE
                )

# count population by sex
svyby(~PWGTP, ~SEX, acs_svy, svytotal)

  SEX      PWGTP       se
1   1 1613811629 12649810
2   2 1660674848 12706528

However, ACS Factfinder1 says:

SEX      PWGTP       se
1        9,616,592   4,379
2        10,179,199  4,379

These numbers are different by a factor of ~160. How can I fix my survey design?

I have tried:

  • using type = "JK1", ; type = "JKn", ; type = "BRR", [[no change]]
  • using repweights = paste("pwgtp",1:80,sep=""), [[no change]]
  • using scale = 1/100, [[no change]]
  • commenting # mse = TRUE, [[no change]]
  • commenting # combined.weights = TRUE [[no change]]
  • changing id to a new variable (id = ~ident,) [[no change]]
    • acs.p\$ident <- acs.p\$SERIALNO * 100 + acs.p\$SPORDER

Thanks.

1 [factfinder.census.gov]1

$\endgroup$
0
$\begingroup$

Yes, silly mistake. Code should read:

...
# make SEX a factor variable
acs.p$SEX <- as.factor(acs.p$SEX)

...

# count population by sex
svytotal(~SEX, acs_svy)
        total     SE
SEX1  9617251 3586.4
SEX2 10178540 3586.4
$\endgroup$
  • $\begingroup$ Why don't you edit your existing response instead of providing an answer to show your changes? $\endgroup$ – StatsStudent Dec 23 '18 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.