marginal.bayesGspline {bayesSurv} | R Documentation

## Summary for the marginal density estimates based on the bivariate model with Bayesian G-splines.

### Description

Compute the estimate of the marginal density function based on the values sampled using the MCMC (MCMC average evaluated in a grid of values) in a model where density is specified as a bivariate Bayesian G-spline.

This function serves to summarize the MCMC chains related to the distributional parts of the considered models obtained using the functions: `bayesHistogram` and `bayesBisurvreg`.

If asked, this function returns also the values of the marginal G-spline evaluated in a grid at each iteration of MCMC.

### Usage

    marginal.bayesGspline(dir = getwd(), extens = "", K, grid1, grid2,
       skip = 0, by = 1, last.iter, nwrite, only.aver = TRUE)

### Arguments

`dir` | directory where to search for files (`mixmoment.sim', `mweight.sim', `mmean.sim', `gspline.sim') with the MCMC sample.
`extens` | an extension used to distinguish different sampled G-splines if more G-splines were used in one simulation (e.g. with doubly-censored data). According to which `bayes*survreg*` function was used, specify the argument `extens` in the following way. bayesHistogram: always `extens = ""` bayesBisurvreg: quad to compute the marginals of the bivariate distribution of the error term for the onset time: `extens = ""`; to compute the marginals of the bivariate distribution of the error term for the event time if there was doubly-censoring: `extens = "_2"`;
`K` | a~vector of length 2 specifying the number of knots at each side of the middle knot for each dimension of the G-spline.
`grid1` | grid of values from the first dimension at which the sampled marginal densities are to be evaluated.
`grid2` | grid of values from the second dimension at which the sampled marginal densities are to be evaluated.
`skip` | number of rows that should be skipped at the beginning of each *.sim file with the stored sample.
`by` | additional thinning of the sample.
`last.iter` | index of the last row from *.sim files that should be used. If not specified than it is set to the maximum available determined according to the file `mixmoment.sim`.
`nwrite` | frequency with which is the user informed about the progress of computation (every `nwrite`th iteration count of iterations change).
`only.aver` | `TRUE/FALSE`, if `TRUE` only MCMC average is returned otherwise also values of the marginal G-spline at each iteration are returned (which might ask for quite lots of memory).

### Value

An object of class `marginal.bayesGspline` is returned. This object is a list with components `margin1` and `margin2` (for two margins).
Both `margin1` and `margin2` components are data.frames with columns named `grid` and `average` where

`grid` | is a grid of values (vector) at which the McMC average of the marginal G-spline was computed.
`average` | are McMC averages of the marginal G-spline (vector) evaluated in `grid`.

There exists a method to plot objects of the class `marginal.bayesGspline`.

### Attributes

Additionally, the object of class `marginal.bayesGspline` has the following attributes:

`sample.size`
  a length of the McMC sample used to compute the McMC average.
`sample1`
  marginal (margin = 1) G-spline evaluated in a grid of values. This attribute is present only if `only.aver = FALSE`.

  This a matrix with `sample.size` columns and length(grid1) rows.

`sample2`
  marginal (margin = 2) G-spline evaluated in a grid of values. This attribute is present only if `only.aver = FALSE`.

  This a matrix with `sample.size` columns and length(grid2) rows.

### Author(s)

Arnost Komarek arnost.komarek@med.kuleuven.be

### References

Komarek, A. (2006). Accelerated Failure Time Models for Multivariate Interval-Censored Data with Flexible Distributional Assumptions. PhD. Thesis, Katholieke Universiteit Leuven, Faculteit Wetenschappen.

Komarek, A. and Lesaffre, E. (2006b). Bayesian semiparametric accelerated failurew time model for paired doubly-interval-censored data. Submitted.
See `Komarek_Lesaffre_2006b.pdf`.

### Examples

    ## See the description of R commands for
    ## the models described in
    ## Komarek (2006),
    ## Komarek and Lesaffre (2006b),
    ##
    ## R commands available
    ## in the documentation
    ## directory of this package
    ## as tandmobPA.pdf, tandmobPA.R.
    ##

[Package bayesSurv version 0.4 Index]