Generates synthetic data matching the cover(response = "lognormal")
generative model:
Arguments
- N
Number of sites (default 200).
- beta_occ
Length-2 occurrence coefficients (intercept, slope on x).
- beta_pos
Length-2 log-cover coefficients (intercept, slope on x).
- sigma_pos
Lognormal residual standard deviation (default 0.4).
- response
Positive-arm likelihood:
"lognormal"(default) or"gaussian".- spatial_range
Length scale of the exponential spatial field (in unit-square distance).
NULLdisables the spatial layer.- spatial_var
Marginal variance of the spatial field (default 1).
- seed
Optional integer seed.
Value
A list with:
- data
A data frame with
cover, covariatex, andlon,lat.- y
data$cover(length-N numeric vector, for passing totobs()).- coords
An N x 2 matrix of coordinates.
- truth
A list with
beta_occ,beta_pos,sigma_pos,p,mu,occur,spatial_occ,spatial_pos.
Details
- eta_occ
= X %*% beta_occ + spatial_occ- eta_pos
= X %*% beta_pos + spatial_pos- p
= plogis(eta_occ)
- occur
~ Bernoulli(p)
- log_cover
~ Normal(eta_pos, sigma_pos^2) | occur = 1
- cover
= exp(log_cover) when occur = 1, else 0
Both layers share the same design matrix by default (one continuous
covariate plus an intercept). When spatial_range is supplied, a simple
exponential-kernel Gaussian field on a random unit-square coordinate set
is added to both linear predictors; the two layers see independently
simulated draws of that field, which matches the two-independent-arm fit.
The joint engine's shared field is a different generative model.
Examples
sim <- simulate_cover(N = 200, seed = 1)
head(sim$data)