Dear Roger and others,

I'll read up on your suggestions, thank you.

I'll post a bit upon a monte carlo that I attempted previously for this
subject, as it might help someone else.

I wrote a monte carlo code a while back trying to get at this (compact,
seemingly fast code with an intel fortran compiler).  The landscape was
broken into separate blocks (a few kilometers on a side) and I performed
the monte carlo in each block separately to get at changes in patterns
across the landscape.  The cells that could be either 0s or 1s (not
belonging to "edge" category) were moved about randomly (sampling without
replacement) and join count stats were calculated after each round of swaps.

The issue was that the vast, vast majority of random patterns created
within blocks had higher BW join counts than patterns actually observed
(reality was much more "clumped").  Let's say I did 10,000 permutations in
a block, typically all of the 10,000 would have higher BW join counts than
the reality (what was actually observed) within that block.  If I wanted to
look at percentile of permutations with BW counts greater than reality,
then it would be all 10,000.  And this would be the same for all blocks, so
I wasn't getting any differences among blocks even though the real patterns
in blocks did differ (they were just all much more clumped than the typical
random pattern created in the monte carlo).  I ran into computing time
issues because carrying out may more than 10,000 permutations across the
landscape would have taken a long time (as the total landscape containing
all blocks was several million cells in size).  What I should have done is
calculated variance in each block on those 10,000 permutations and then
used it to get a z-score (instead of using percentiles), but still I would
be concerned that the true variability was not being expressed (10,000 or
so only captured typically dispersed patterns and not enough to get a
handle on the more rare clumped patterns that would be in the tail of the
distribution).

Seth


On Tue, May 14, 2013 at 4:47 AM, Roger Bivand <Roger.Bivand@nhh.no> wrote:

> On Mon, 13 May 2013, Seth Myers wrote:
>
>  Question: Any suggestions on calculating the expectation and variance of
>> BW
>> joins on a raster/matrix where edge effects are not treated as a nuisance
>> but rather are included in the calculation?
>>
>
> Interesting question! My feeling would be that your shortest route to a
> resolution is to use Monte Carlo simulation instead of analytical variances.
>
> However, you may need to work out how to model the actual memory process
> over time, which would lead to a parametric bootstrap, or possibly a
> Bayesian model.
>
> This feels somewhat like state-space modelling, where you are interested
> in the probability of a raster cell changing category, conditional on its
> neighbours' status and change history. There was a JSS special number on
> state space modelling recently (but I may be barking up the wrong tree!).
>
> Hope this helps,
>
> Roger
>
>
>> Background:
>>
>> Let's say I have a raster (or matrix) that is NxN cells. The cells take on
>> values of 0 or 1 (W or B).
>>
>> The outer edge of this raster (cell[ ,1] or cell [ ,N] or cell [1, ] or
>> cell [N, ]) can be 0s or 1s.  Let's say for argument that the edge as
>> defined is composed of all 1 values and this is known a prior and does not
>> change.
>>
>> Now, the interior of the raster (all cells not part of edge) take on
>> values
>> of 0 or 1 with a certain probability(cell=1)=[whatever value is most
>> appropriate in the context].
>>
>> I would like to know the expected value for 1-0 (or BW) joins over the
>> entire NxN raster given that the edge is set and joins with the edges
>> "count" toward the final tally of BW joins but the interior cells are 1s
>> (or black) with a certain probability.  Also, I would like to know the
>> variance of BW joins over the entire NxN raster given these same
>> conditions.
>>
>> I am interested because the "edge" in this analysis represents a previous
>> landscape and I would like to know what the future can hold given previous
>> conditions (the "memory" or "hysteresis" of the landscape going into the
>> future).
>>
>> I am flexible on whether free sampling or non-free sampling is assumed,
>> with a guess that free sampling will be more tractable.  Also, for
>> simplicity, I would stick with rook case joins and only first neighbors
>> (directly adjacent cells).
>>
>> I have searched for a function that computes join counts while taking into
>> account edge effects, but have come up empty handed.
>>
>> I have looked at how expectations of BW joins and the variances are
>> computed, and I believe another day of work will result in code where I
>> can
>> get the expectation under free sampling while taking into account the
>> edge.
>> That is because the expectation calculation is rather straightforward.
>> However, I do not understand the variance calculation well enough to know
>> how to proceed on it.
>>
>> Any input is appreciated.
>>
>> Seth Myers
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________**_________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>>
>>
> --
> Roger Bivand
> Department of Economics, NHH Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand@nhh.no
>
>

	[[alternative HTML version deleted]]

