Hi Guy,
It's hard to say what the problem is without playing around with the data, but
I'm working on a fix that should hopefully side-step this issue. I'll let you
know when that's available. In the meantime, you can run Amelia without checks, by
setting the "incheck" argument to FALSE. This will bypass the error checking
procedures in Amelia and go straight to the imputation.
Hope that helps!
Cheers,
matt.
On Wednesday, June 20, 2012 at 10:05 PM, Guy Grossman wrote:
Error in if (sum(non.vary == 0)) { :
argument is not interpretable as logical
I searched online but was unable to find a way to correct this error.
I have actually relatively few missing variables. any idea what I can do to get rid of
the error.
Your response would be highly appreciated!
Guy
# define variables' type
ords = c("post_elections", "prev_elections",
"election_year")
noms = c("type", "region", "split_cat",
"splinter", "mother", "breakup", "home_winner",
"tribe_winner", "support_winner", "opposed",
"irregularity", "home_loser", "tribe_loser",
"support_loser", "politics_loser", "mobilize_loser",
"ethnic_min", "ethnicity_dec_major", "dom_ethnic02",
"turn_majority", "contig_border", "TYPE_2")
idvars = c("county_name", "district_11", "regions_67",
"district_80", "district_91", "district_96",
"district_01", "district_02", "district_06",
"district_07")
lags = c("split_cat", "mshare_county")
logs = c("area", "pop")
lgstc = c("mshare", "mshare_county", "cshare_county",
"elf02", "eduattain", "literacy", "employee",
"pio", "nag_pio", "nag_employee", "pl02",
"pi02", "perclit91", "percillit91")
a.out <- amelia(DistrictFormation, m = 5, ts = "wave", cs = "id",
polytime = 2, intercs = TRUE,
idvars=idvars, ords=ords, noms=noms, logs=logs, lgstc=lgstc)
Error in if (sum(non.vary == 0)) { :
argument is not interpretable as logical
str(DistrictFormation)
'data.frame': 474 obs. of 109 variables:
$ id : num 1 1 1 2 2 2 3 3 3 4 ...
$ wave : int 1 2 3 1 2 3 1 2 3 1 ...
$ county_name : chr "BUJUMBA" "BUJUMBA"
"BUJUMBA" "KYAMUSWA" ...
$ county_id02 : num 1011 1011 1011 1012 1012 ...
$ region : Factor w/ 4 levels "CENTRAL","EASTERN",..:
1 1 1 1 1 1 1 1 1 1 ...
$ district_11 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ regions_67 : chr "MASAKA" "MASAKA" "MASAKA"
"MASAKA" ...
$ district_80 : chr "MASAKA" "MASAKA" "MASAKA"
"MASAKA" ...
$ district_91 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ district_96 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ district_01 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ district_02 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ district_06 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ district_07 : chr "KALANGALA" "KALANGALA"
"KALANGALA" "KALANGALA" ...
$ ndist80 : num 18 18 18 18 18 18 18 18 18 18 ...
$ ndist91 : num 39 39 39 39 39 39 39 39 39 39 ...
$ ndist02 : num 56 56 56 56 56 56 56 56 56 56 ...
$ ndist06 : num 72 72 72 72 72 72 72 72 72 72 ...
$ ndist07 : num 80 80 80 80 80 80 80 80 80 80 ...
$ ndist11 : num 109 109 109 109 109 109 109 109 109 109 ...
$ n1991 : num 2 2 2 2 2 2 1 1 1 4 ...
$ n1996 : num 2 2 2 2 2 2 1 1 1 4 ...
$ n2001 : num 2 2 2 2 2 2 1 1 1 3 ...
$ n2006 : num 2 2 2 2 2 2 1 1 1 2 ...
$ ncounties : num 2 2 2 2 2 2 1 1 1 4 ...
$ type : chr "COUNTY" "COUNTY" "COUNTY"
"COUNTY" ...
$ post_elections : num 2001 2006 2011 2001 2006 ...
$ prev_elections : num 1996 2001 2006 1996 2001 ...
$ split_cat : Factor w/ 3 levels "No
Split","Splinter",..: 1 1 1 1 1 1 1 1 1 3 ...
$ splinter : num 0 0 0 0 0 0 0 0 0 0 ...
$ mother : num 0 0 0 0 0 0 0 0 0 1 ...
$ breakup : num 0 0 0 0 0 0 0 0 0 1 ...
$ election_year : int 2001 2006 2011 2001 2006 2011 2001 2006 2011 2001 ...
$ mshare_county : num 0.667 0.539 0.639 0.677 0.535 ...
$ cshare_county : num 0.317 0.403 0.296 0.304 0.421 ...
$ mmargin_county : num 0.343 0.137 0.342 0.365 0.115 ...
$ mshare : num 0.693 0.585 0.689 0.693 0.585 ...
$ mshare_cat : num 0.695 0.622 0.706 0.695 0.622 ...
$ MP_nrm_share : num -999 1 1 -999 0 1 -999 1 1 -999 ...
$ home_winner : int 0 0 0 1 1 1 1 1 1 0 ...
$ tribe_winner : Factor w/ 37 levels "ACHOLI","ALUR",..: 6 6
6 6 6 6 6 6 6 6 ...
$ support_winner : int 0 0 1 1 1 1 1 1 1 1 ...
$ opposed : int 1 1 0 1 1 0 0 1 1 1 ...
$ irregularity : int 0 0 0 0 0 0 0 0 0 0 ...
$ home_loser : int 1 1 0 0 0 0 1 1 1 0 ...
$ tribe_loser : Factor w/ 37 levels "ACHOLI","ALUR",..: 6 6
6 6 6 6 6 13 13 6 ...
$ support_loser : int 1 1 0 0 0 0 0 0 0 0 ...
$ politics_loser : int 0 1 0 0 1 0 0 1 0 1 ...
$ mobilize_loser : int 0 0 0 0 0 0 0 0 0 1 ...
$ county_dec_share : num 0.6 0.4 0.6 0.4 0.6 ...
$ ethnic_min : num 0 0 0 0 0 0 0 0 0 0 ...
$ ethnicity_dec_major : Factor w/ 37 levels "ACHOLI","ALUR",..: 6 6
6 6 6 6 6 6 6 6 ...
$ control_dec_ethnicity: num 1 1 0.8 1 1 ...
$ pop : num 17271 17271 17271 17428 17428 ...
$ dom_ethnic02 : Factor w/ 37 levels "ACHOLI","ALUR",..: 6 6
6 6 6 6 6 6 6 6 ...
$ share_dom_ethnic02 : num 67.7 67.7 67.7 60.2 60.2 ...
$ turn_majority : num 0 0 0 0 0 0 0 0 0 0 ...
$ pop02 : int 17271 17271 17271 17428 17428 17428 229297 229297 229297
137199 ...
$ elf02 : num 0.528 0.528 0.528 0.624 0.624 ...
$ schools_tot_pop : num 0.811 0.811 0.811 0.689 0.689 ...
$ schools_tot : num 14 14 14 12 12 12 260 260 260 170 ...
$ other_tot_pop : num 0.116 0.116 0.116 0 0 ...
$ other_tot : num 2 2 2 0 0 0 1 1 1 1 ...
$ primary_tot_pop : num 0.579 0.579 0.579 0.631 0.631 ...
$ primary_tot : num 10 10 10 11 11 11 229 229 229 142 ...
$ sec_tot_pop : num 0.1158 0.1158 0.1158 0.0574 0.0574 ...
$ sec_tot : num 2 2 2 1 1 1 30 30 30 27 ...
$ gov_primary_pop : num 0.521 0.521 0.521 0.459 0.459 ...
$ gov_primary : num 9 9 9 8 8 8 188 188 188 81 ...
$ gov_sec_pop : num 0.1158 0.1158 0.1158 0.0574 0.0574 ...
$ gov_sec : num 2 2 2 1 1 1 7 7 7 6 ...
$ eduattain : num 0.222 0.222 0.222 0.241 0.241 ...
$ literacy : num 0.818 0.818 0.818 0.826 0.826 ...
$ pl02 : num 0.12 0.12 0.12 0.04 0.04 ...
$ se_po02 : num 1.89 1.89 1.89 0.93 0.93 ...
$ pg02 : int 2 2 2 1 1 1 10 10 10 9 ...
$ se_pg02 : num 0.48 0.48 0.48 0.2 0.2 ...
$ pi02 : num 0.0033 0.0033 0.0033 0.0036 0.0036 ...
$ sepi02 : num 1.14 1.14 1.14 1.63 1.63 ...
$ npoor02 : int 2014 2014 2014 772 772 772 79497 79497 79497 45674 ...
$ se_npoor02 : int 326 326 326 162 162 162 3164 3164 3164 1962 ...
$ elf91 : num 0.43 0.43 0.43 0.458 0.458 ...
$ area : num 2356 2356 2356 6672 6672 ...
$ pop91 : int 7335 7335 7335 6872 6872 6872 132711 132711 132711 105562
...
$ pl91 : num 0.365 0.365 0.365 0.261 0.261 ...
$ pg91 : num 10.1 10.1 10.1 7.1 7.1 ...
$ gini91 : num 29.9 29.9 29.9 32.6 32.6 ...
$ popdensity91 : num 3.11 3.11 3.11 1.03 1.03 ...
$ censuspop91 : int 9192 9192 9192 7179 7179 7179 141607 141607 141607 108098
...
$ perclit91 : num 0.711 0.711 0.711 0.729 0.729 ...
$ percillit91 : num 0.289 0.289 0.289 0.271 0.271 ...
$ distance_border : num 81855 81855 81855 94097 94097 ...
$ contig_border : int 0 0 0 0 0 0 0 0 0 0 ...
$ distance_kampala : num 86.6 86.6 86.6 80.2 80.2 ...
$ pio : num 0.668 0.668 0.668 0.704 0.704 ...
$ employee : num 0.358 0.358 0.358 0.393 0.393 ...
$ nag_pio : num 0.249 0.249 0.249 0.15 0.15 ...
$ nag_employee : num 0.1628 0.1628 0.1628 0.0701 0.0701 ...
$ pop_county18 : num 10257 10257 10257 12185 12185 ...
[list output truncated]