Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/bayMCMC_np_global.R

Estimate the bandwidths in the regression function approximated by the functional Nadaraya-Watson estimator and kernel-form error density with one global bandwidth, in a functional nonparametric regression

1 2 3 4 | ```
bayMCMC_np_global(data_x, data_y, data_xnew, warm = 1000, M = 1000,
mutprob = 0.44, errorprob = 0.44, mutsizp = 1, errorsizp = 1,
prior_alpha = 1, prior_beta = 0.05, err_int = c(-10, 10),
err_ngrid = 10001, num_batch = 20, step = 10, alpha = 0.95, ...)
``` |

`data_x` |
An (n by p) matrix of discretised data points of functional curves |

`data_y` |
A scalar-valued response of length n |

`data_xnew` |
A matrix of discretised data points of new functional curve(s) |

`warm` |
Number of iterations for the burn-in period |

`M` |
Number of iterations for the Markov chain Monte Carlo (MCMC) |

`mutprob` |
Optimal acceptance rate of the random-walk Metropolis algorithm for sampling the bandwidth in the regression function |

`errorprob` |
Optimal acceptance rate of the random-walk Metropolis algorithm for sampling the bandwidth in the kernel-form error density |

`mutsizp` |
Initial step length of the random-walk Metropolis algorithm for sampling the bandwidth in the regression function. Its value will be updated at each iteration to achieve the optimal acceptance rate, given the MCMC converges to its target distribution |

`errorsizp` |
Initial step length of the random-walk Metropolis algorithm for sampling the bandwidth in the kernel-form error density. Its value will be updated at each iteration to achieve the optimal acceptance rate, given the MCMC converges to its target distribution |

`prior_alpha` |
Hyperparameter of the inverse gamma prior distribution for the squared bandwidths |

`prior_beta` |
Hyperparameter of the inverse gamma prior distribution for the squared bandwidths |

`err_int` |
Range of the error-density grid for computing its probability density function and cumulative probability density function |

`err_ngrid` |
Number of the error-density grid points |

`num_batch` |
Number of batches to assess the convergence of the MCMC |

`step` |
Thinning parameter. For example, when |

`alpha` |
The nominal coverage probability of the prediction interval, customarily 95 percent |

`...` |
Other arguments used to define semi-metric. For a set of smoothed functional data, the semi-metric based on derivative is suggested. For a set of rough functional data, the semi-metric based on the functional principal component analysis is suggested |

The Bayesian method estimates the bandwidths in the regression function and kernel-form error density in the context of the functional nonparametric regression with homoscedastic errors. It performs better than the functional cross validation in terms of estimation accuracy, since the latter one does not utilise the information about the unknown error density

`xpfinalres` |
Estimated bandwidths |

`mhat` |
Estimated regression function |

`sif_value` |
Simulation inefficiency factor |

`mlikeres` |
Marginal likelihood calculated using the Chib's (1995) method |

`acceptnwMCMC` |
Acceptance rate for sampling bandwidth in the regression function |

`accepterroMCMC` |
Acceptance rate for sampling bandwidth in the kernel-form error density |

`fore.den.mkr` |
Estimated probability density function of the error |

`fore.cdf.mkr` |
Estimated cumulative density function of the error |

`point forecast` |
Predicted response |

`PI` |
Prediction interval of response |

It can be time-consuming when the sample size is large, say above 250

Han Lin Shang

H. L. Shang (2013) Bayesian bandwidth estimation for a semi-functional partial linear regression model with unknown error density, *Computational Statistics*, in press.

H. L. Shang (2013) Bayesian bandwidth estimation for a nonparametric functional regression model with unknown error density, *Computational Statistics and Data Analysis*, **67**, 185-198.

X. Zhang and R. D. Brooks and M. L. King (2009) A Bayesian approach to bandwidth selection for multivariate kernel regression with an application to state-price density estimation, *Journal of Econometrics*, **153**, 21-32.

F. Ferraty, I. Van Keilegom and P. Vieu (2010) On the validity of the bootstrap in non-parametric functional regression, *Scandinavian Journal of Statistics*, **37**, 286-306.

R. Meyer and J. Yu (2000) BUGS for a Bayesian analysis of stochastic volatility models, *Econometircs Journal*, **3**(2), 198-215.

S. Chib (1995) Marginal likelihood from the Gibbs output, *Journal of the American Statistical Association*, **90**(432), 1313-1321.

`bayMCMC_np_local`

, `bayMCMC_semi_global`

1 2 3 4 5 | ```
htm = proc.time()
dum = bayMCMC_np_global(data_x = simcurve_smooth_normerr, data_y = simresp_np_normerr,
data_xnew = simcurve_smooth_normerr, warm = 50, M = 100, range.grid=c(0,pi), q=2,
nknot=20)
proc.time() - htm
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.