syunhong / seg

R package 'seg' for measuring and visualising population segregation
10 stars 5 forks source link

spatial weights implementation does not match 2008 demography paper #1

Closed bfjarvis closed 5 years ago

bfjarvis commented 6 years ago

Currently the spatial weights in envconstruct.c do not follow the formula provided on p. 511 in:

Reardon, S. F., Matthews, S. A., O'Sullivan, D., Lee, B. A., Firebaugh, G., Farrell, C. R., & Bischoff, K. (2008). The Geographic Scale of Metropolitan Racial Segregation. Demography, 45(3), 489–514.

Right now the weights are implemented as:

  if (expF == 0) // Inverse distance weight
    weight = 1/pow(dxy + error, power);
  else           // Inverse distance weight using an exponential function
    weight = exp(dxy * power * -1);     

But it seems a more appropriate implementation would be:

  if (expF == 0) // biweight kernel (normal-like)
    weight = pow(1 - pow(dxy/dist, power), power);
  else           // normalized/scaled inverse exponential 
    weight = (exp(dxy/dist * power * -1) - exp(power * -1))/(1 - exp(power * -1));     
syunhong commented 5 years ago

This issue has been addressed in version 0.5-5 (25 September 2018). Thanks!