Bayesian model inference for fractional polynomial models from the generalized linear model family or the Cox model is conducted by means of either exhaustive model space evaluation or posterior model sampling. The approach is based on analytical marginal likelihood approximations, using integrated Laplace approximation. Alternatively, testbased Bayes factors (TBFs) are used.
1 2 3 4 5 6 7 8 9  glmBayesMfp(formula = formula(data), censInd = NULL,
data = parent.frame(), weights, offset, family, phi = 1, tbf = FALSE,
empiricalBayes = FALSE, fixedg = NULL, priorSpecs = list(gPrior =
HypergPrior(), modelPrior = "sparse"), method = c("ask", "exhaustive",
"sampling"), subset, na.action = na.omit, verbose = TRUE, debug = FALSE,
nModels, nCache = 1e+09, chainlength = 10000, nGaussHermite = 20,
useBfgs = FALSE, largeVariance = 100, useOpenMP = TRUE,
higherOrderCorrection = FALSE, fixedcfactor = FALSE,
empiricalgPrior = FALSE, centerX = TRUE)

formula 
model formula 
censInd 
censoring indicator. Default is 
data 
optional data.frame for model variables (defaults to the parent frame) 
weights 
optionally a vector of positive weights (if not provided, a vector of one's) 
offset 
this can be used to specify an _a priori_ known component to be included in the linear predictor during fitting. This must be a numeric vector of length equal to the number of cases (if not provided, a vector of zeroes) 
family 
distribution and link (as in the glm function). Needs to be explicitly specified for all models except the Cox model. 
phi 
value of the dispersion parameter (defaults to 1) 
tbf 
Use TBF methodology to compute the marginal likelihood? (not
default) Must be 
empiricalBayes 
rank the models in terms of conditional
marginal likelihood, using an empirical Bayes estimate of g? (not default)
Due to coding structure, the prior on g must be given in 
fixedg 
If this is a number, then it is taken as a fixed value of g,
and as with the 
priorSpecs 
prior specifications, see details 
method 
which method should be used to explore the posterior model space? (default: ask the user) 
subset 
optional subset expression 
na.action 
default is to skip rows with missing data, and no other option supported at the moment 
verbose 
should information on computation progress be given? (default) 
debug 
print debugging information? (not default) 
nModels 
how many best models should be saved? (default: 1% of the
total number of (cached) models). Must not be larger than 
nCache 
maximum number of best models to be cached at the same time during the model sampling, only has effect if method = sampling 
chainlength 
length of the model sampling chain (only has an effect if sampling has been chosen as method) 
nGaussHermite 
number of quantiles used in Gauss Hermite quadrature
for marginal likelihood approximation (and later in the MCMC sampler for the
approximation of the marginal covariance factor density). If

useBfgs 
Shall the BFGS algorithm be used in the internal maximization
(not default)? Else, the default Brent optimize routine is used, which seems
to be more robust. If 
largeVariance 
When should the BFGS variance estimate be considered
“large”, so that a reestimation of it is computed? (Only has an
effect if 
useOpenMP 
shall OpenMP be used to accelerate the computations? (default) 
higherOrderCorrection 
should a higherorder correction of the Laplace approximation be used, which works only for canonical GLMs? (not default) 
fixedcfactor 
If TRUE sets the c factor assuming alpha is set to 0. Otherwise take alpha=mean(y) 
empiricalgPrior 
If TRUE uses the the observed isnformation matrix instead of X'X in the g prior. 
centerX 
Center the data before fitting (FALSE) 
The formula is of the form y ~ bfp (x1, max = 4) + uc (x2 + x3)
, that
is, the auxiliary functions bfp
and uc
must be
used for defining the fractional polynomial and uncertain fixed form
covariates terms, respectively. There must be an intercept, and no other
fixed covariates are allowed. All max
arguments of the
bfp
terms must be identical. y
is the response vector
for GLMs or the vector of survival times for Cox regression. Note that Cox
regression is only implemented with TBFs.
The prior specifications are a list:
A gprior class object. Defaults to a hyperg prior. See
GPrior
for more information.
choose if a flat model prior ("flat"
), a
model prior favoring sparse models explicitly (default, "sparse"
),
or a dependent model prior ("dependent"
) should be used.
If method = "ask"
, the user is prompted with the maximum
cardinality of the model space and can then decide whether to use
posterior sampling or the exhaustive model space evaluation.
Note that if you specify only one FP term, the exhaustive model search must be done, due to the structure of the model sampling algorithm. However, in reality this will not be a problem as the model space will typically be very small.
An object of S3 class GlmBayesMfp
.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.