John Darrenwood
2011-Nov-05 16:33 UTC
[R] ANESRAKE package: Inappropriate error message, given the data
Hi, Attempting to use the "anesrake" raking (also referred to as rim weighting) package to weight survey data (Note: DATA is listed at the bottom along with SESSION INFO AND COMMANDS ARGUMENTS USED to allow you to reproduce the error). Presents following error message: *"Error in selecthighestpcts(discrep1, inputter, pctlim) : * * No variables are off by more than 5 percent using the method you have chosen, either weighting is unnecessary or a smaller pre-raking limit should be chosen."* However the sample proportions for the demographics are in fact far more than 5% off the target proportions (see data below) no matter what choosemethod argument is used. Have tried different "pctlim" settings as well (even small ones such as 0.0001) and still get same message. Also tried different "choosemethod" - both "max" and "total". Tried to get help from the following but see nothing on this error in these references: *Package description at: cran.r-project.org/web/packages/anesrake/anesrake .pdf* *Paper by Josh Pasek: http://www.stanford.edu/~jpasek/Josh_Pasek/Software_files/RakingDescription.pdf * Here is the* session info*:> sessionInfo()R version 2.14.0 (2011-10-31) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_South Africa.1252 LC_CTYPE=English_South Africa.1252 [3] LC_MONETARY=English_South Africa.1252 LC_NUMERIC=C [5] LC_TIME=English_South Africa.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] anesrake_0.70 Hmisc_3.8-3 survival_2.36-10 loaded via a namespace (and not attached): [1] cluster_1.14.1 grid_2.14.0 lattice_0.20-0 HERE ARE THE ARGUMENTS> medufo <- read.csv("C:/Users/lenovo/Desktop/Medufo_weights/medufo.csv",header = TRUE, row.names="ID")> age <- c(25, 25, 28, 22) > gender <- c(49, 51) > ethnic <- c(58, 14, 5, 23) > income <- c(1, 4, 7, 15, 18, 16, 19, 17, 1, 1,1) > targets <- list(age, gender, ethnic, income) > names(targets) <- c("age", "gender", "ethnic", "income") > outsave <- anesrake(targets, medufo, caseid=1, verbose = TRUE) > write.csv(print(outsave),"C:/Users/lenovo/Desktop/Medufo_weights/outsave.csv") HERE IS THE DATA LISTING> list(medufo)[[1]] age gender ethnic income 20 2 1 1 7 23 3 1 4 6 28 2 1 1 10 31 2 1 1 8 32 4 1 4 8 35 1 1 3 8 38 3 1 4 9 40 3 1 4 9 43 2 1 1 8 46 3 1 3 6 48 2 1 1 4 58 3 1 4 8 63 2 1 3 8 64 3 1 1 7 72 2 1 1 8 81 3 1 4 8 88 4 1 4 6 89 3 1 1 8 90 4 1 4 8 93 1 1 1 8 94 3 1 4 8 98 2 1 1 8 104 2 1 1 10 109 3 1 2 7 110 1 1 2 7 114 1 1 1 5 119 1 1 4 4 124 1 1 4 7 132 3 1 4 8 141 3 1 4 10 142 4 1 4 7 3 2 2 1 10 5 1 2 2 4 6 4 2 1 8 8 2 2 3 6 9 2 2 1 8 10 3 2 4 8 11 2 2 4 8 13 3 2 1 7 14 2 2 4 8 15 2 2 1 8 16 2 2 4 8 19 2 2 4 8 21 3 2 1 7 22 3 2 1 6 24 4 2 4 8 25 4 2 4 5 26 3 2 4 8 27 4 2 4 8 30 3 2 4 10 33 4 2 2 5 34 2 2 2 5 36 3 2 4 7 37 2 2 1 4 39 3 2 4 7 41 2 2 4 8 42 2 2 3 1 45 3 2 2 8 47 3 2 2 5 49 3 2 4 7 51 3 2 4 8 52 1 2 2 4 53 3 2 4 8 54 4 2 4 4 55 2 2 4 11 56 2 2 4 4 57 3 2 3 7 59 2 2 3 7 60 3 2 4 7 61 3 2 2 8 65 2 2 1 8 66 3 2 2 5 67 3 2 4 9 68 1 2 4 7 69 1 2 1 4 70 3 2 4 8 73 2 2 1 5 74 2 2 2 8 75 2 2 1 5 76 4 2 1 7 77 2 2 4 7 78 2 2 4 7 79 1 2 2 6 80 2 2 1 6 82 4 2 4 8 83 3 2 4 8 85 2 2 1 6 86 2 2 4 8 87 2 2 1 3 91 3 2 4 8 92 2 2 4 8 95 4 2 4 7 96 2 2 1 9 97 3 2 4 8 99 2 2 1 7 100 1 2 3 7 102 1 2 4 6 103 1 2 2 7 105 1 2 2 4 106 4 2 4 6 107 3 2 3 5 108 2 2 4 8 112 1 2 3 4 113 2 2 4 8 115 1 2 4 6 116 4 2 4 8 117 2 2 4 7 118 2 2 4 7 120 3 2 4 11 121 3 2 4 8 122 4 2 4 8 123 3 2 4 8 125 2 2 4 8 126 2 2 4 8 127 4 2 4 3 128 3 2 4 5 130 3 2 4 9 131 3 2 4 9 133 4 2 4 7 134 3 2 4 9 135 1 2 4 6 137 4 2 4 7 138 3 2 4 7 139 3 2 4 7 140 2 2 4 11 143 3 2 3 11 144 3 2 4 8 145 1 2 4 8 146 3 2 4 9 147 3 2 4 7 148 3 2 4 2 149 2 2 4 6 Thanks [[alternative HTML version deleted]]
Apparently Analagous Threads
- Graphical option to update.packages in development version (build of the 2011-07-31 r56569) for Windows not working properly
- Calling R functions with multiple arguments from C
- Recoding several variables into one use the most recent data
- Reshape by multiple variables
- I am leaving llvm