aggregate_migration: Aggregate a Migration Matrix to Match a Coarser Raster

Description Usage Arguments Value

Description

This converts a migration matrix computed for one raster into a migration matrix for another raster that is coarser than the first. This function does no re-normalization.

Usage

1
2
3
aggregate_migration(M, old, new,
  from.old = which(!is.na(raster::values(old))), to.old = from.old,
  from.new = which(!is.na(raster::values(new))), to.new = from.new)

Arguments

M

The migration matrix.

old

The original Raster* the migration matrix was computed for.

new

The Raster* for the new migration matrix.

from.old

The indices of the "from" cells corresponding to rows in the original migration matrix.

to.old

The indices of the "to" cells corresponding to columns in the original migration matrix.

from.new

The indices of the "from" cells corresponding to rows in the resulting migration matrix.

to.new

The indices of the "to" cells corresponding to columns in the resulting migration matrix.

Value

A migration matrix. See migrate. The resulting matrix has [i,j]th entry equal to the average over all rows in the old matrix that correspond to 'i' of the sum of columns in that row corresponding to j. In other words, if the old matrix M is indexed by [u,v], then the new matrix's [i,j]th entry is: (1/n(j)) sum_v: j(v)=j sum_u : i(u)=i M[u,v] where n(j) = # v : j(v)=j .


petrelharp/landsim documentation built on May 25, 2019, 2:53 a.m.