
Space-time models: GTWR, multiscale GWR by backfitting, Gaussian hidden Markov models
Source:R/SpaceTimeModels.R
GtwrFit.RdGtwrFit: local weighted least squares with space-time kernel
weights; distance sqrt(lam d_S^2 + mu d_T^2) (Huang et al. 2010) or
lam d_S + (1 - lam) d_T + 2 sqrt(lam (1 - lam) d_S d_T) cos(ksi)
(distance = "fotheringham", GWmodel::gtwr, which also uses
past_only = TRUE); bisquare, gaussian or exponential kernels.
MgwrBackfit: multiscale GWR with fixed per-covariate bandwidths by
backfitting from OLS until sqrt(|RSS1 - RSS0| / RSS1) < threshold;
centred predictors with intercepts reported on the uncentred scale (as
GWmodel::gwr.multiscale with fixed bandwidths). GaussianHmm:
Baum-Welch EM with scaled forward-backward recursions for one or several
series sharing parameters, then Viterbi paths (0-based states).
Usage
GtwrFit(
y,
X,
coords,
times,
bandwidth,
lam = 1,
mu = 1,
kernel = "bisquare",
distance = "huang",
ksi = 0,
past_only = FALSE
)
MgwrBackfit(
y,
X,
coords,
bandwidths,
kernel = "bisquare",
center = TRUE,
threshold = 1e-10,
max_iter = 5000
)
GaussianHmm(
series,
n_states,
means = NULL,
sds = NULL,
trans = NULL,
init = NULL,
max_iter = 1000,
tol = 1e-12
)Arguments
- y
Response.
- X
Regressor matrix (an intercept is added).
- coords
Coordinate matrix (rows are observations).
- times
Observation times.
- bandwidth
Space-time bandwidth.
- lam, mu
Space and time distance weights.
- kernel
"bisquare", "gaussian" or "exponential".
- distance
"huang" or "fotheringham".
- ksi
Angle of the Fotheringham distance.
- past_only
Give weight only to observations at or before the focal time.
- bandwidths
Bandwidths for the intercept and each covariate.
- center
Centre the covariates.
- threshold
Backfitting convergence threshold.
- max_iter
Maximum iterations.
- series
Numeric vector, or list of vectors.
- n_states
Number of hidden states.
- means, sds, trans, init
Optional starting values.
- tol
Log-likelihood tolerance.
References
Huang, B., Wu, B. and Barry, M. (2010). IJGIS 24, 383-401. Fotheringham, A. S., Crespo, R. and Yao, J. (2015). Geographical Analysis 47, 431-452. Fotheringham, A. S., Yang, W. and Kang, W. (2017). Annals AAG 107, 1247-1265. Rabiner, L. R. (1989). Proc. IEEE 77, 257-286.
Examples
GaussianHmm(c(0.1, -0.2, 0, 5.1, 4.9, 5.2, 0.2, -0.1), 2)$states
#> [[1]]
#> [1] 0 0 0 1 1 1 0 0
#>