Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating area of window densities #30

Open
Imogen-D opened this issue Jul 19, 2022 · 2 comments
Open

Calculating area of window densities #30

Imogen-D opened this issue Jul 19, 2022 · 2 comments

Comments

@Imogen-D
Copy link

Hi,

This is a little of an out-the-box question, but I'm wondering if you have a method in mind to be able to calculate the area of the window estimates (at the three % densities). I'm hoping to use this as a way of comparing different model accuracies.

I've been looking at attempting to convert the kd object from the density estimates in the plot_locator script into a contour object using contourlines and then calculating the area from IRTFM's answer here https://stackoverflow.com/questions/8406507/how-can-i-calculate-the-area-within-a-contour-in-r , however this is not spatially relevant and seems to output spurious results.

I then attempted to convert this to a SpatialLinesDataFrame with ContourLines2SLDF().
However, I am then stuck on two aspects;

  1. which levels were used by the contour() plotting function per probability, as the calculation of probabilities as per https://stackoverflow.com/questions/16225530/contours-of-percentiles-on-level-plot is a little unclear as to its inner workings.
    And 2) how to convert this lines object into closed polygons from which I can then calculate the area.

I'll keep working on it, but was just wondering whether you can provide any ideas.

I've attached (your) plotting script with my current edits for extracting the area as per lines 198-242 (plot_locator2.txt), as well as some example metadata (unknown and known for error calculations) and 20 predlocs from 1 sample. Please excuse the ugly way of attaching these, I'm still fairly new to coding!

Looking forward to hearing from you, let me know if you need any other information from me

plot_locator2.txt

knownmetadata.txt
metadata.txt

A1_1.ALminmac200_7931566_locindv_predlocs.txt.gz
A1_1.ALminmac200_991410_locindv_predlocs.txt.gz
A1_1.ALminmac200_1092513_locindv_predlocs.txt.gz
A1_1.ALminmac200_1483743_locindv_predlocs.txt.gz
A1_1.ALminmac200_1548919_locindv_predlocs.txt.gz
A1_1.ALminmac200_2045261_locindv_predlocs.txt.gz
A1_1.ALminmac200_2171080_locindv_predlocs.txt.gz
A1_1.ALminmac200_2349043_locindv_predlocs.txt.gz
A1_1.ALminmac200_3038660_locindv_predlocs.txt.gz
A1_1.ALminmac200_3238820_locindv_predlocs.txt.gz
A1_1.ALminmac200_3484727_locindv_predlocs.txt.gz
A1_1.ALminmac200_3749675_locindv_predlocs.txt.gz
A1_1.ALminmac200_5333187_locindv_predlocs.txt.gz
A1_1.ALminmac200_5808436_locindv_predlocs.txt.gz
A1_1.ALminmac200_6034974_locindv_predlocs.txt.gz
A1_1.ALminmac200_6115573_locindv_predlocs.txt.gz
A1_1.ALminmac200_6381378_locindv_predlocs.txt.gz
A1_1.ALminmac200_6477477_locindv_predlocs.txt.gz
A1_1.ALminmac200_6993546_locindv_predlocs.txt.gz
A1_1.ALminmac200_7022405_locindv_predlocs.txt.gz

@petrelharp
Copy link
Collaborator

Hi, @Imogen-D - this isn't something that we have looked at, and I don't know how to get this information out of the contour plots. Have you thought about some other measure of accuracy, e.g., mean pairwise distance between estimates? Or, the root-mean-squared distance of an estimate to the mean estimate? Or, what is the area of the minimal circle centered on the mean estimate that contains 95% of the estimates?

@Imogen-D
Copy link
Author

Hi, thank you so much for your quick response!

Thank you so much for your ideas, I'll have a think and see what I come up with, I have a feeling that something like the mean pairwise distance would be a much more straightforward approach and should show what we want it to.

Cheers again for the software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants