Description Usage Arguments Details Value See Also Examples

Bayesian semiparametrics are used to fit the Heffernan–Tawn model to time series. Options are available to impose a structure in time on the model.

1 2 3 4 |

`ts` |
numeric vector; time series to be fitted. |

`u.mar` |
marginal threshold; used when transforming the time series to Laplace scale. |

`u.dep` |
dependence threshold; level above which the dependence is modelled. |

`lapl` |
logical; is |

`method.mar` |
a character string defining the method used to estimate the marginal GPD; either |

`nlag` |
integer; number of lags to be considered when modelling the dependence in time. |

`par` |
an object of class 'bayesparams'. |

`submodel` |
a character string; "fom" for |

`submodel`

can be `"fom"`

to impose a first order Markov structure on the model parameters *α_j* and *β_j* (see `thetafit`

for more details); it can take the value `"none"`

to impose no particular structure in time; it can also be `"ugm"`

which can be applied to density estimation, as it corresponds to setting *α=β=0* (see examples).

An object of class 'bayesfit' with elements:

`a ` |
posterior trace of |

`b ` |
posterior trace of |

`sd ` |
posterior trace of the components' standard deviations. |

`mean ` |
posterior trace of the components' means. |

`w ` |
posterior trace of the components' assigned weights. |

`prec ` |
posterior trace of the precision parameter. |

`noo ` |
posterior trace of the number of observations per component. |

`noc ` |
posterior trace of the number of components containing at least one observation. |

`prop.sd ` |
trace of proposal standard deviations in the 5+3 regions of the adaption scheme for |

`len ` |
length of the returned traces. |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
## generate data from an AR(1)
## with Gaussian marginal distribution
n <- 10000
dep <- 0.5
ar <- numeric(n)
ar[1] <- rnorm(1)
for(i in 2:n)
ar[i] <- rnorm(1, mean=dep*ar[i-1], sd=1-dep^2)
## rescale the margin
ar <- qlapl(pnorm(ar))
## fit the data
params <- bayesparams()
params$maxit <- 100# bigger numbers would be
params$burn <- 10 # more sensible...
params$thin <- 4
fit <- depfit(ts=ar, u.mar=0.95, u.dep=0.98, par=params)
########
## density estimation with submodel=="ugm"
data <- MASS::galaxies/1e3
dens <- depfit(ts=data, par=params, submodel="ugm")
``` |

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.