seananderson / glmmfields

R package for Bayesian spatial and spatiotemporal GLMMs with possible extremes
50 stars 10 forks source link

Can glmmfields be used to fit 1-D models? #4

Closed ericward-noaa closed 6 years ago

ericward-noaa commented 6 years ago

Someone asked me the other day about whether glmmfields can fit 1-D spatial models (like along a coastline). The answer is yes -- it's maybe not the fastest implementation of 1-D gaussian process models, but we can do that by setting latitude or longitude to some constant. For example,

s <- sim_glmmfields(n_draws = 12, n_knots = 12, gp_theta = 1.5, gp_sigma = 0.2, sd_obs = 0.2)

s$dat$lon = 0 # set to arbitrary constant

m <- glmmfields(y ~ 0, time = "time", lat = "lat", lon = "lon", data = s$dat, nknots = 12, iter = 1000, chains = 4, seed = 1)