sim_lu: Simulating land-use from a data generating process

View source: R/simulation.R

sim_luR Documentation

Simulating land-use from a data generating process

Description

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

Usage

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

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

Vector of dimensions n \times 1. Provides the spatial observation areas a_i for calculating targets T_1,...,T_J. Defaults to a random uniform matrix.

alphas

Matrix of dimensions T \times J. Provides the true values for all \alpha_{jt}. The J-th column of the matrix has to be equal to zero. Defaults to a random uniform matrix.

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

Matrix of dimensions k \times J. Provides the values for \beta_1,...,\beta_J. The J-th column of the matrix has to be equal to zero. Defaults to a matrix of random, normally distributed values (with zero mean and uniform variance).

Details

The generated multinomial logit land use model over J distinct land uses (with j',j = 1,...,J) takes the form:

y_{ijt} = \frac{\exp(\alpha_{jt} + X_i \beta_j)}{ \sum^{J}_{j' = 1} \exp(\alpha_{jt} + X_i \beta_{j'})}

with X_i being 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.

The function generates the NT \ times J matrix Y. Based on this, the function generates a set of targets T_{jt} for downscaling. These are calculated by:

T_{jt} = \sum^n_{i=1} y_{ijt} a_i

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_lu(n = 100)

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