[R-sig-Geo] Sampling random directional lines within a polygon

Barry Rowlingson b@row||ng@on @end|ng |rom gm@||@com
Wed Feb 6 21:23:53 CET 2019


Do you want to generate these for input into some statistical process, or
to generate some test data that looks a bit like real data? I think
generating test data isn't too difficult, but anything that you might want
to put into a statistical test (eg testing some hypothesis about the birds
maximum deviation from the straight line A-B) needs a lot more care in
formulating the path generating process.

Here's some thoughts - if you consider one of the red segments in your map
as a piece of string (rather than 10 segments) anchored at the points, then
you can stretch it taut with a pencil and draw an ellipse with A and B as
the foci. Any path created with that string - taut or slack as in your map
- has to strictly lie within the ellipse. Now you can wiggle that string
inside that ellipse and create an infinity of paths from A to B of the same
length. I'm not sure how you can sample uniformly from that infinity such
that any path has an equal sampling probability. Your problem is similar
but has the additional rigid segment constraint.

Any two adjacent segments of a chain, eg 1----2-------3, as long as it
isn't taut (ie straight) can be perturbed by holding 1 and 3 still and
moving 2 to the "mirror image" point over the straight line from 1 to 3.
You can also take three segments 1--2--3--4 and hold 1 and 4 still and
perturb 2 and 3 fairly easily. In this way you could set up an initial
chain and then run multiple perturbations on the chain to get a "random"
chain, but quite what set of all chains it would be a sample from is not
clear. It could at least generate reasonable looking paths, but I wouldn't
want to test a hypothesis against it.

I'm going to generate a path from my office to my home now.

Barry






On Wed, Feb 6, 2019 at 7:50 PM Hannah Justen <justen using tamu.edu> wrote:

> Hello everyone,
>
> Thank you very much for the suggestions.
>
> Regarding more details (please also see attached figure):
> I would like to simulate a bird's migration between breeding (starting
> polygon - blue in the figure) and wintering grounds (end polygon - green in
> the figure). The lines can start from anywhere within the starting polygon
> and end anywhere in the end polygon. The lines shall consist of 10
> connected segments with variable length between 300 and 1000 km (see red
> lines in figure; two examples of possible lines with 10 segments between
> the polygons).
>
> Thank you very much for you help,
> Hannah
>
> ---
> PhD Student |Ecology and Evolutionary Biology
> Texas A&M University
>
> On Wed, Feb 6, 2019 at 5:12 AM Barry Rowlingson <
> b.rowlingson using lancaster.ac.uk> wrote:
>
>> Interesting, but I think we need more details...
>>
>> Do the lines have to start and finish at specific locations in the
>> polygons - like the centroid, or anywhere?
>>
>> So one line might be 3 segments of 10km each connecting two polygon
>> centroids that are 15km apart? Imagining three rigid rods of length 10
>> connected at their ends and with the first and last also connected to two
>> fixed points tells me there's an infinite number of possible solutions.
>> There's probably also a number of ways of sampling from those solutions.
>> Its going to get very complicated with a larger number of segments.
>>
>> Hmmmmm.....
>>
>> Barry
>>
>>
>>
>>
>> On Tue, Feb 5, 2019 at 11:30 PM Hannah Justen <justen using tamu.edu> wrote:
>>
>>> Hi everyone,
>>>
>>> I am studying migratory tracks of birds for my dissertation and I would
>>> like to model possible pathways between two polygons. Therefore, I would
>>> like to sample random lines between the polygons. These lines can differ
>>> in
>>> total length but should consist of x - number of fragments of equal
>>> length.
>>> Each fragment can have slightly different orientation but overall the
>>> lines
>>> should connect the two polygons.
>>>
>>> I fail to find the appropriate R package that will allow me to do this
>>> type
>>> of analysis. Does anyone have a suggestion how to approach analysis?
>>>
>>> Thank you,
>>> Hannah
>>>
>>> ---
>>> PhD Student |Ecology and Evolutionary Biology
>>> Texas A&M University
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=JTKhaSJXwF2BxCfjjnt61w&m=RH21jOLOEbLLudn70kOTH0wnklnKHk-tFm9cxjxAB9k&s=H_HhNMga7aaqbnNsWexqY1jdRFFo7zO_m9xvk2awODo&e=>
>>>
>>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list