sim_luc: Simulating land-use change from a data generating process

View source: R/simulation.R

sim_lucR Documentation

Simulating land-use change from a data generating process

Description

This function can be used to generate land use change data from a data generating process

Usage

sim_luc(
  n,
  J = 3,
  tt = 2,
  k = 1,
  areas = matrix(runif(n * J), n, J),
  alphas = replicate(J, cbind(matrix(stats::runif(tt * (J - 1)), tt, J - 1), 0), simplify
    = FALSE),
  xmat = matrix(stats::rnorm(n * k), n, k),
  betas = replicate(J, cbind(matrix(stats::rnorm(k * (J - 1)), k, J - 1), 0), simplify =
    FALSE)
)

Arguments

n

Number of spatial observations n.

J

Number of land use classes J. Defaults to three.

tt

Number of time steps to simulate T. Defaults to two.

k

Number of covariates to simulate k. Defaults to one.

areas

A matrix of dimensions n \times J. Provides the spatial observation of areas a_{ij1} in t=1 for calculating targets T_1,...,T_J. Defaults to a random uniform matrix.

alphas

A list of length J. Each list item contains a matrix of dimensions T \times J. These provide the true values for all \alpha_{ljt}. The J-th column of the matrix has to be equal to zero. Defaults to a list containing random uniform matrices.

xmat

Matrix of dimensions n \times k. Provides the values for the matrix X. Defaults to a matrix of random, normally distributed values (with zero mean and uniform variance).

betas

A list of length J. Each list item contains a matrix of dimensions k \times J. Provides the values for each \beta_{1l},...,\beta_{jl}. The J-th column of the matrix has to be equal to zero. Defaults to a list containing J matrices of random, normally distributed values (with zero mean and uniform variance).

Details

The function simulates a set of J different multinomial logit land use models over J distinct land uses (with j',j = 1,...,J). Each of the models takes the form:

y_{iljt} = \frac{\exp(\alpha_{ljt} + X_i \beta_{lj})}{ \sum^{J}_{j' = 1} \exp(\alpha_{ljt} + X_i \beta_{lj'})}

where l denotes the individual multinomial logit models. X_i is the i-th row of the n \times k matrix X. \beta_j is the k \times J matrix of land use class specific slope parameters. \alpha_{jt} are class specific intercepts, which are typically optimised using the bias correction method. These are assumed to vary over time.

For the purpose of identification the slope parameters \beta_J and intercepts \alpha_J associated with the J-th class have to be zero.

Each of the J different models captures land use being converted from the l-th land use class to J other land uses.

The function generate J different NT \ times J matrices Y_l. Based on these, the function generates a set of targets T_{ljt} for downscaling. These are calculated by:

T_{ljt} = \sum^n_{i=1} y_{iljt} a_{ilt}.

The initial values for a_il1 are randomly generated. After this the values of a_{ilt} are dynamicall updated through:

a_{ilt+1} = \sum^n_{j=1} y_{iljt} a_{ilt}

The output of this function can be directly used in downscale.

Value

A list with the generated \alpha (alphas), X (xmat), \beta (betas), Y (Y), and T (targets). The returned values are in long format as required by downscale.

Examples

dgp1 = sim_luc(n = 100)

tkrisztin/downscalr documentation built on June 2, 2025, 1:16 a.m.