kaijagahm / ygdpDashboard

Interactive dashboard for YGDP survey data
3 stars 0 forks source link

polygons do not appear if a polygon's interpolated value is >5 or <1 #46

Closed ianneidel closed 3 years ago

ianneidel commented 3 years ago

Due to the color scale being set between 1 and 5, polygons with a value outside of that are displayed as transparent. Survey 9's "my sister scares me of..." shows this for <1 and "the dog wants in" shows this for >5. For these very acceptable/unacceptable sentences, interpolation may slightly overshoot and exit the 1-5 range. The color scale could be extended (e.g. to .9 - 5.1) to fix this. Screen Shot 2021-01-20 at 10 32 38 AM Screen Shot 2021-01-20 at 10 29 26 AM

kaijagahm commented 3 years ago

Having the polygons not display was by design--but I hadn't realized that this was due to the values actually exceeding the 5/1 bounds. I don't really understand why they would do this... maybe there's something about IDW I'm not understanding.

@ianneidel are you sure this is the problem, rather than NA values? Although, come to think of it, I don't know why we would have NA's.

Anyway, i'll try extending the color scale and see if it gets fixed.

kaijagahm commented 3 years ago

Ah, sure enough, you're right! I just checked and there are indeed values lower than 1 and higher than 5.

@ianneidel do you think this would be better solved by extending the color scale, or by setting limits on those high and low values (i.e. coerce values lower than 1 to 1, and values higher than 5 to 5)?

I guess I'm worried that allowing values higher than 5 and lower than 1 will be confusing because we've stated that ratings on the surveys had to be between 1 and 5. I also don't know how much we'd have to extend the color scale to be "safe" in these interpolations: e.g. what are the minimum and maximum possible values? I'd want to extend the scale to 0 and 6 to be safe, and I think that would be especially confusing for the color legend.

It is possible that I could split the difference here: allow the color scale to extend to 0 and 6, but then only show values 1 through 5 on the legend bar to avoid confusing people. The chances people will notice the rare hexagon that strays slightly beyond the bounds of the shown colors are low, and if they do, we can provide a note in the "About" section of the app explaining our methodology.

But of course, there's a downside to coercing the values to 1 and 5, as well, since that isn't strictly adhering to the model outputs.

Let me know what you think!

ianneidel commented 3 years ago

Hmm @kaijagahm. I'm not entirely sure how the IDW formula would produce values greater (or less than) any and all of the points that inform it although I'm pretty sure the missing polygons are only slightly above 5/below 1 (or that's how they were when I interpolated for the dialect quiz). Whatever the case, a rating of above 5 clearly doesn't make any sense when we're using a 1-5 scale so I think it would be ideal to coerce those values to 5 and 1 as you suggested.

kaijagahm commented 3 years ago

Sounds good, thanks @ianneidel. I'm going to go ahead and coerce > 5 to 5 and <1 to 1, and then we'll see how that looks. Working on it now.

kaijagahm commented 3 years ago

Fixed this in the INT.R script and re-wrote the data: https://github.com/kaijagahm/ygdpDashboard/commit/1cacdc26adf50386904995eb27952dad3036364e