Giter VIP home page Giter VIP logo

shar's People

Contributors

actions-user avatar bisaloo avatar chriswudel avatar kant avatar marcosci avatar mhesselbarth avatar rubak avatar tretherington avatar zekemarshall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shar's Issues

Using classes

Maybe instead of checking if objects are suitable, introduce classes?

Reproduce point pattern to a larger window-extent

Hello,

I would like to reconstruct a point pattern from a small tree plot data to a larger size (eg. from 0.3 ha to 1 ha).
For this, I tried reconstruct_pattern_marks(). However, I learned that it will produce a pattern with the same number of points.
Do you have any advice, which function I can use for this? I wonder if there is an option to vary the number of points and window-extent to reconstruct.

Thanks,
kiranaw

Community guidelines

Regarding @openjournals/joss-reviews#3811 JOSS requires "clear guidelines for third parties wishing to 1) Contribute to the software 2) Report issues or problems with the software 3) Seek support" so I think you need to add something to the README to explain that.

I think I also forgot to include this for my JOSS paper ๐Ÿ˜ณ, so if it is helpful you could look at my virtualNicheR package to see how I included that information.

Homepage

Can you please do your homepage magic @marcosci ? I started with a .yaml-file but not quite sure how do build it.

Paper typos

Regarding @openjournals/joss-reviews#3811 I think there a couple of typos that you could correct:

Line 41: environmental conditions need to be broken by randomizing the data as a null model
Line 45: The first approach to simulate null model data, is to randomize the environmental data

select_species

Not sure if the function is really needed or just an old artifact of older package structure

Test data examples potentially confusing?

Regarding @openjournals/joss-reviews#3811 I'm wondering if you could improve the test data examples slightly to avoid any confusion.

Ideally I think I should be able to run test data and get exactly the same results to confirm everything is working properly. This is a bit challenging for you as the software uses data randomisation so you are unlikely to get exactly the same results. However, I think it would be helpful if the conclusions of the results stays the same.

Everything seems to be fine with

results_habitat_association(pattern = species_a, raster = torus_trans)
## > Input: randomized raster | Quantile thresholds: negative < 0.025 - positive > 0.975
##   habitat count lo hi significance
## 1       1     9  2 14         n.s.
## 2       2    25  9 24     positive
## 3       3    27 11 26     positive
## 4       4     0 11 29     negative
## 5       5    12  5 18         n.s.

for which I get identical output in R.

But for

results_habitat_association(pattern = reconstruction, raster = landscape_classified)
## > Input: randomized point pattern | Quantile thresholds: negative < 0.025 - positive > 0.975
##   habitat count    lo    hi significance
## 1       1     8  1.00 23.35         n.s.
## 2       2    22 25.85 49.10     negative
## 3       3    33 40.80 68.05     negative
## 4       4    19 44.00 71.10     negative
## 5       5   118 20.85 60.05     positive

I get the following result

results_habitat_association(pattern = reconstruction, raster = landscape_classified)
> Input: randomized point pattern | Quantile thresholds: negative < 0.025 - positive > 0.975
  habitat count    lo    hi significance
1       1     8 27.90 48.10     negative
2       2    22 52.90 77.05     negative
3       3    33 29.00 57.30         n.s.
4       4    19 24.90 46.10     negative
5       5   118 11.85 26.00     positive

that has quite differrent lo and hi values, and different significance results for habitat classes 1 and 3.

I am assuming that all is running correctly, but I feel a bit nervous that my conclusion is different to that of the test data example.

I would suggest you:

  1. Double-check that the output in the README is correct and up to date - I suppose there is a chance you changes the test data but forgot to update the README output.
  2. Consider setting the random seed set.seed() as part of the example code so that the results will be the same.
  3. Perhaps manipulate the test data such that the while the exact numbers may vary, at least the significance of the results is consistent.

Clear statement of dependancies

Regarding @openjournals/joss-reviews#3811 JOSS requires a "clearly-stated list of dependencies" at the moment you state in the README that "shar is mainly based on the spatstat (Baddeley et al. 2015) and raster (Hijmans 2017) package" but I think you should be specific as shar also requires the rcpp package.

I would suggest listing these somewhere, perhaps within the installation section.

I have spotted that you have an open issue about whether to include the rcpp requirement. This is very much a style thing, but I prefer to have absolutely minimal package dependencies to make maintenance easier. So you could help resolve this issue by removing that rcpp dependency - but a clear list of the remaining dependencies would still be helpful I think ๐Ÿ˜„

Annealing

Keep relocated pattern even if energy did not decrease in a few cases if e.g. annealing = 0.001

Rcpp

rcpp_sample is a little bit faster than sample but maybe that is not worth the Rcpp dependency since its the only function?

Integrate reconstruct_pattern_multi

This issue tracks all steps to integrate the new reconstruct_pattern_multi function into the package. For this, I created a new branch called changes_multi.

  • Update NEWS and cran-comments
  • Update CITATION
  • Update READE and Hompage with new citation info
  • Update DESCRIPTION (Author, version, imports)
  • Make sure file structure is consistent (e.g., separate internal function file for each function)
  • Run R-CMD-Check
  • Update testthat suite
  • Maybe add vignette?

Clarify expectations around NA data in the raster landscape

Regarding openjournals/joss-reviews#3811 I think there should be a note somewhere, perhaps in the README or the paper, maybe both around the expectation of how NA data in the raster landscape would be handled.

All the examples and supporting papers cited seem to work with landscapes that are "complete" in that points can occur anywhere within the unit-square for the point-process models and there is habitat everywhere within the raster landscape. But I suspect that in reality it will be quite common for the study area to be a more complex shape than a rectangle, and therefore there will be NA cells within the raster landscape in which points cannot occur. So I am left wondering if it is theoretically reasonable to use the methods in shar with that kind of data. Essentially I am querying how NA data in a raster landscape is handled.

If shar can't handle NA data that is absolutely fine, but I do think it should be highlighted to potential users if that will preclude use of the package so that they can quickly eliminate shar as an option if it won't work for them.

Apologies if I have missed that information somewhere, but if it does exist, perhaps it could be made more prominent as I think that could have a massive bearing for potential users.

Broken link in README

"Both functions return a list with randomized rasters and the observed one. For more information on the methods, please click here."

The here link currently doesn't go anywhere.

Bring reconstruct_pattern functions under one

The four reconstruct_pattern functions could be brought together into one where the user specify the type of reconstruction wanted, the function could then look like:

reconstruct_pattern(pattern, type = c("homo", "hetero", "cluster", "mark"))

Why a point pattern approach to habitat analyses

Regarding @openjournals/joss-reviews#3811 requirement for a statement of need, I am not aware of any point pattern software in R that allows someone to do habitat analyses, so in that regard I am happy that this software fills a gap.

However, I think it would be helpful for me to understand if there are situations where this approach is beneficial over the multitude of other ways I could take xy point data and a raster and produce some sort of habitat/species distribution/ecological niche model.

I don't feel like I can articulate this question very well, so I do apologise for that ๐Ÿ˜ฌ, and I haven't had time to fully read and digest the cited papers, but I think it could be very helpful to potential users to understand any specific instances where these kinds of approaches are beneficial when compared to other similar presence-background approaches available in R packages such as dismo, biomod2, zoon, adehabitat, and the like.

I guess I would say that at the moment I don't see what the benefit of treating my xy location data as a point pattern and analysing it though shar.

I am mentioning this as if you can highlight that benefit somehow, then I think you will increase the likelihood of ecologists engaging with shar.

Include links to citations in README

Regarding @openjournals/joss-reviews#3811 I would have found it helpful to have links to the citations in the README. Any chance you could please add the missing links you have in the paper to the README as well? I think people who find your package via GitHub rather than via JOSS would find that helpful.

Quantum plot

Add a quantum plot style to plot_randomized_pattern(x, method = "sf").

Better use of classes

  • Save used method (e.g. fitted or reconstructed)
  • Better printing
  • Save energy
  • Save stoping criterion

Ideas future updates

In case you have ideas for future updates, simply post them here!

  • simplify argument for all functions that would return only one element (e.g. reconstruct_pattern() with n_random = 1 and return_input = FALSE
  • add mark-correlation reconstruction
  • stop pattern reconstruction if energy doesn't change (or only very little) for n iterations
  • Make a difference between verbose (for warnings) and progress printing

README UTF code

There seems to be a problem with the references, probably an issue with UTF codes

Create plot methods for the shar object

Regarding issue openjournals/joss-reviews#3811, it would be easiest if plot methods were created for the objects derived from shar (i.e. rd_pat), so basically instead of having to call:

pattern_random <- fit_point_process(species_a, n_random = 19, process = "cluster")
plot_randomized_pattern(pattern_random)

One could simply do:

plot(pattern_random)

This could be achieved by turning the plot_* functions into plot.rd_pat and plot.rd_ras, check http://adv-r.had.co.nz/S3.html for instance.

Add precision in DESCRIPTION file

Regarding openjournals/joss-reviews#3811, shar deals with point pattern data linked to categorical (discrete) environment variables. This information on the data requirements should be in the DESCRIPTION file. Maybe:

Therefore, information about the location of the species (as a point pattern) is needed together with environmental conditions (as a categorical raster).

Support/switch to terra

Probably worth supporting terra soon or even make terra default und allow raster as legacy mode

Axis in pair correlation plots

This is related to openjournals/joss-reviews#3811, the pair correlation plots from plot_reconstructed_pattern sometime show axis that do not span the whole range of the data:

pp <- spatstat.core::rLGCP(win=spatstat.geom::owin(c(0, 10), c(0, 10)))
ff <- fit_point_process(pp)
plot_reconstructed_pattern(ff)

pcof

Include breaks into results_habitat_association

@ZekeMarshall had the idea to not include the breaks additionally to the classes in the results_habitat_association() table.

That's a good idea, however, the breaks are not necessarily included in the provided raster object. Maybe add an argument (default NA or NULL), which allows providing breaks in the same order as classes. In this case, the breaks from classifiy_habitats could be used. Or maybe a data.frame which would allow to merge classes to breaks.

Related, maybe write a short helper function to convert the classInterval object as data.frame.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.