Obtain samples from the fitted LnGM model parameters.
simulate.RdObtain samples from the fitted LnGM model parameters.
Arguments
- object
An ngvb.list object (output of
ngvbfunction).- n.sampling
Integer. Number of samples.
- components
Vector containing
c("LGM","V","ng","hyperpar"). Ifcomponentscontains"LGM"then it generates samples of \((\mathbf{x},\boldsymbol{\theta})\) usinginla.posterior.sample. If it contains"hyperpar"then generate samples of \(\boldsymbol{\theta}\) usinginla.hypearpar.sample. It it contains"V"or"ng"then generate samples from the mixing variables \(\mathbf{V}\) and \(\eta\) for each model component, respectively.- improved.tail
Logical. If
TRUEgenerate leptokurtic samples of the the latent field \(\mathbf{x}\). It first generates samples of \((\mathbf{V},\boldsymbol{\theta})\) and then it generates samples of \(\mathbf{x} | \mathbf{V} , \boldsymbol{\theta}, \mathbf{y}\) (which is an LGM) by fitting an INLA model each time and generating n =augmentationsamples. Slow. Reducen.samplingfor speed and increaseaugmentationto obtain more samples.- augmentation
Integer. If
improved.tail = TRUE, then for each sample of \((\mathbf{V},\boldsymbol{\theta})\) generate n =augmentationsamples of \(\mathbf{x} | \mathbf{V} , \boldsymbol{\theta} , \mathbf{y}\).
Examples
if (FALSE) {
#Here we fit an RW1 latent process to the jumpts time series
plot(jumpts)
#Fit LGM with INLA
LGM <- inla(y ~ -1 + f(x, model = "rw1"),
data = jumpts)
#Fit LnGM with ngvb
LnGM <- ngvb(fit = LGM, selection = list(x=1:100))
#Available methods
summary(LnGM)
print(LnGM)
plot(LnGM)
fitted(LnGM)
samples <- simulate(LnGM)
}