Title: | Wavelet Functional ANOVA Through Markov Groves |
---|---|
Description: | Functional denoising and functional ANOVA through wavelet-domain Markov groves. Fore more details see: Ma L. and Soriano J. (2018) Efficient functional ANOVA through wavelet-domain Markov groves. <arXiv:1602.03990v2 [stat.ME]>. |
Authors: | Jacopo Soriano and Li Ma |
Maintainer: | Li Ma <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.1 |
Built: | 2024-11-05 03:56:14 UTC |
Source: | https://github.com/cran/grove |
This function carries out Bayesian wavelet denoising using the Normal Inverse Gamma Markov Tree method of Ma and Soriano (2016).
Denoise(W, alpha = 0.5, nu = 5, n.samples = 500, transition.mode = "Markov", method = "Nelder-Mead")
Denoise(W, alpha = 0.5, nu = 5, n.samples = 500, transition.mode = "Markov", method = "Nelder-Mead")
W |
An object of class |
alpha |
Hyperparameter controlling the global smoothness. |
nu |
Hyperparameter controlling variance heterogeneity. If |
n.samples |
Number of posterior draws. |
transition.mode |
Type of transition.
The two options are |
method |
Method used for find maxmimum of marginal likelihood. |
An object of class grove
.
Ma L. and Soriano J. (2016) Efficient functional ANOVA through wavelet-domain Markov groves. arXiv:1602.03990v2 [stat.ME] (https://arxiv.org/abs/1602.03990v2).
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W)
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W)
This function performs the discrete wavelet transform (DWT) according to Mallat's pyramidal algorithm (Mallat, 1989).
DWT(data, filter.number = 10, family = "DaubLeAsymm")
DWT(data, filter.number = 10, family = "DaubLeAsymm")
data |
A matrix of data, where each row is an observation. The number of columns must be a power of two. |
filter.number |
The smoothness of the wavelet to use in the decomposition. |
family |
The family of wavelets. The two most common options
are |
See function wd
from package wavethresh
for more details.
A DWT
object. This object is a list with the following
components:
data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 10) W <- DWT(data$noisy.Y)
data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 10) W <- DWT(data$noisy.Y)
This function carries out Bayesian functional ANOVA using the Normal Inverse Gamma Markov Grove method of Ma and Soriano (2016).
FAnova(W, X, formula, nu = 5, is.kappa.fixed = FALSE, gamma.kappa = 0.3, eta.kappa = 0.1, n.samples = 500, transition.mode = "Markov", method = "Nelder-Mead")
FAnova(W, X, formula, nu = 5, is.kappa.fixed = FALSE, gamma.kappa = 0.3, eta.kappa = 0.1, n.samples = 500, transition.mode = "Markov", method = "Nelder-Mead")
W |
An object of class |
X |
Design matrix. |
formula |
An object of class formula. |
nu |
Hyperparameter controlling the heterogeneity in the noise variance. |
is.kappa.fixed |
If |
gamma.kappa |
Hyperparameter for the MT transition matrix. |
eta.kappa |
Hyperparameter for the MT transition matrix. |
n.samples |
Number of posterior draws. |
transition.mode |
Type of transition. The two options are |
method |
Method used for find maxmimum of marginal likelihood. |
An object of class grove
.
Ma L. and Soriano J. (2016) Efficient functional ANOVA through wavelet-domain Markov groves. arXiv:1602.03990v2 [stat.ME] (https://arxiv.org/abs/1602.03990v2).
## Not run: data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 5) W <- DWT(data$noisy.Y) X <- data$X ans <- FAnova(W, X, ~ 1 + factorA + factorB) denoised.data <- InvDWT(ans, x = c(0, 0, 1, 0)) PlotFun(denoised.data) ## End(Not run)
## Not run: data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 5) W <- DWT(data$noisy.Y) X <- data$X ans <- FAnova(W, X, ~ 1 + factorA + factorB) denoised.data <- InvDWT(ans, x = c(0, 0, 1, 0)) PlotFun(denoised.data) ## End(Not run)
This function generates a synthetic 3-factor functional ANOVA dataset.
GenerateSyntheticAnova(st.dev = 10, n.replicates = 5)
GenerateSyntheticAnova(st.dev = 10, n.replicates = 5)
st.dev |
The standard deviation of the error. |
n.replicates |
The number of replicates for each factor combination. |
A list containing the data without noise, the data with noise, and the design matrix.
data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 10) ix <- 1 plot(data$clean.Y[ix, ], type = "l", col = "red", ylab = "") lines(data$noisy.Y[ix, ], col = "blue")
data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 10) ix <- 1 plot(data$clean.Y[ix, ], type = "l", col = "red", ylab = "") lines(data$noisy.Y[ix, ], col = "blue")
The grove package implements a wavelet-domain Bayesian hierarchical model for functional analysis of variance.
This function performs the inverse discrete wavelet transform.
InvDWT(grove.obj, x = NULL, include.C = TRUE, sample.C = FALSE)
InvDWT(grove.obj, x = NULL, include.C = TRUE, sample.C = FALSE)
grove.obj |
An object of class |
x |
A vector of the values of a predictor. |
include.C |
If |
sample.C |
If |
A matrix with each row representing a draw from the reconstructed signal.
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W) denoised.data <- InvDWT(ans) plot(data, type = "l") lines(denoised.data[1, ], col = "red")
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W) denoised.data <- InvDWT(ans) plot(data, type = "l") lines(denoised.data[1, ], col = "red")
This function plots the credible bounds of the denoised signal.
PlotFun(data, p = c(0.025, 0.5, 0.975), band.type = "pointwise", main = "", col = "blue", type = "l", ylab = "", xlab = "", ylim = NULL)
PlotFun(data, p = c(0.025, 0.5, 0.975), band.type = "pointwise", main = "", col = "blue", type = "l", ylab = "", xlab = "", ylim = NULL)
data |
Matrix of posterior samples. |
p |
Vector with the lower, center and upper quantile. |
band.type |
Type of credible intervals. The options are:
|
main |
The main title of the plot. |
col |
The color of the point estimate. |
type |
The type of line of the point estimate. |
ylab |
The label of the y-axis. |
xlab |
The label of the x-axis. |
ylim |
The range of the y-axis. |
A plot.
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W) denoised.data <- InvDWT(ans) PlotFun(denoised.data) PlotFun(denoised.data, band.type = "both")
data <- wavethresh::DJ.EX(n = 512, noisy = TRUE, rsnr = 5)$doppler W <- DWT(data) ans <- Denoise(W) denoised.data <- InvDWT(ans) PlotFun(denoised.data) PlotFun(denoised.data, band.type = "both")
This function plots on a tree the state of each latent variables.
PlotStates(grove.obj, block = "Intercept", legend = FALSE, main = NULL, prior = FALSE)
PlotStates(grove.obj, block = "Intercept", legend = FALSE, main = NULL, prior = FALSE)
grove.obj |
Output from function |
block |
Which block to plot. |
legend |
If |
main |
Main title. |
prior |
If |
A plot.
## Not run: data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 5) W <- DWT(data$noisy.Y) X <- data$X ans <- FAnova(W, X, ~ 1 + factorA + factorB) PlotStates(ans) PlotStates(ans, block = "factorA") PlotStates(ans, block = "factorB") ## End(Not run)
## Not run: data <- GenerateSyntheticAnova(st.dev = 5, n.replicates = 5) W <- DWT(data$noisy.Y) X <- data$X ans <- FAnova(W, X, ~ 1 + factorA + factorB) PlotStates(ans) PlotStates(ans, block = "factorA") PlotStates(ans, block = "factorB") ## End(Not run)