Skip to contents

For each pixel in a spatiotemporal raster x time datacube,estimate a linear regression model with 0/1 jumps such that the jump event is correlated within neighbouring pixels.

Usage

tj_fit_m0.6(
  x,
  dat = NULL,
  timevar = "z",
  attrvar = "values",
  niter = 1000,
  gamma = 0,
  prior_theta = list(m = c(a = 0, b = 0), S = diag(1e+05 * c(1, 1))),
  prior_delta = list(m = 0, s2 = 1e+05, a = -Inf, b = Inf),
  prior_sigma2 = c(shape = 2, rate = 1),
  prior_k = 0.5,
  verbose = FALSE,
  ctrl = list(burnin = 0.5, thin_steps = 1),
  keep_hist = TRUE,
  cells_to_ignore = NULL,
  ignore_cells_with_na = TRUE,
  neighbourhood_type = "square",
  neighbourhood_range = 1,
  neighbourhood_scale_to_8 = TRUE,
  ...
)

Arguments

x

input stars object

dat

prepared data frame (for development, please dont use).

niter

number of gibbs sampler interations

gamma

interaction parameter. Multiplies the kernel-values in the neighbourhood. 0 means no spatial correlation.

prior_theta

prior (m=vec, S=matrx) for intercept and trend parameter, same for all cells

prior_delta

prior(m=num, s2=num>0, a=num, b=num>a) truncated normal prior for eac jump, trucate to [a,b]

prior_k

prior jump probabilities. Either a vector (will be normalised) or a single value for the probability of jump somewhere.

keep_hist

If TRUE, keep the mcmc trajectories of all variables. If vector of cell indices, keep history for only those (to save space). Give at least 2 cell-indices or logical, otherwise unexpected behaviour. (default: FALSE).

neighbourhood_type

How is neighbourhood defined (default: "square")

neighbourhood_range

How large neighbourhood (default: 1)

neighbourhood_scale_to_8

Logical: Scale the sum of weights over full neighbhourhood to 8?

...

ignored

Details

We assume the datacube holds for each pixel (x-y) a series of values (`attrvar`) in time (`timevar`).

The model estimate for each series the best linear regression line such that there might be a jump of size delta after one of the time points 1...T-1. The special estimate "jump after T" means no jump is predicted.

Explanation for `neighbourhood_scale_to_8`: For comparison reasons, the original neighobuhrood was the nearest-8 adjacent pixels. Setting the parameter TRUE will scale sum over any neighbourhood to be 8, to make kernel choice and gamma more independent.