glmModelData: Process the data needed for modelling

Description Usage Arguments Value Author(s) Examples

Description

Process the data needed for modelling

Usage

1
2
3
4
5
6
  glmModelData(y, X, continuous = rep.int(TRUE, ncol(X)),
    nKnots = 4L, splineType = "linear",
    gPrior = HypergnPrior(a = 4, n = length(y)),
    weights = rep.int(1L, length(y)),
    offsets = rep.int(0L, length(y)), family = gaussian,
    phi = 1)

Arguments

y

the numeric response vector

X

the numeric matrix of covariates

continuous

logical vector specifying which covariates really are continous and can be included nonlinearly in a model (default: all covariates are continuous)

nKnots

number of (quantile-based) spline knots (default: 4)

splineType

type of splines to be used (default: “linear”), see makeBasis for possible types.

gPrior

A g-prior class object. Defaults to a hyper-g/n prior. See GPrior for more information. Deprecated but still possible for backwards-compatibility is the use of the strings “hyper-g/n” or “hyper-g”.

weights

optionally a vector of positive weights (if not provided, a vector of ones)

offsets

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)

phi

value of the dispersion parameter (defaults to 1)

Value

a list with the internally needed results.

Author(s)

Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## get some data
attach(longley)

## try the function
md <- glmModelData(y=as.numeric(Employed > 64),
                   X=cbind(GNP, Armed.Forces),
                   family=binomial)

## look at the results
str(md)


## try again with cubic splines
md <- glmModelData(y=as.numeric(Employed > 64),
                   X=cbind(GNP, Armed.Forces),
                   nKnots=10L,
                   splineType="cubic",
                   family=binomial)

## look at the results
str(md)

hypergsplines documentation built on May 2, 2019, 6:14 p.m.