tvcm-methods: Methods for 'tvcm' objects

Description Usage Arguments Details Author(s) See Also Examples

Description

Standard methods for computing on tvcm objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## S3 method for class 'tvcm'
coef(object, ...)

## S3 method for class 'tvcm'
depth(x, root = FALSE, ...)

## S3 method for class 'tvcm'
extract(object, what = c(
              "control", "model", 
              "nodes", "sctest", "p.value",
              "devgrid", "cv", "selected",
              "coef", "sd", "var"),
        steps = NULL, ...)

## S3 method for class 'tvcm'
neglogLik2(object, ...)

## S3 method for class 'tvcm'
predict(object, newdata = NULL,
        type = c("link", "response", "prob", "class",
          "node", "coef", "ranef"),
        ranef = FALSE, na.action = na.pass, ...)

## S3 method for class 'tvcm'
splitpath(tree, steps = 1L,
         details = FALSE, ...)

## S3 method for class 'tvcm'
summary(object, ...)

## S3 method for class 'tvcm'
width(x, ...)

Arguments

object, tree, x

an object of class tvcm.

root

logical scalar. Should the root count be counted in depth?

steps

integer vector. The iteration steps from which information should be extracted.

newdata

an optional data frame in which to look for variables with which to predict, if omitted, the fitted values are used.

type

character string. Denotes for predict the type of predicted value. See predict.glm or predict.olmm. "response" and "prob" are identical.

na.action

function determining what should be done with missing values for fixed effects in newdata. The default is to predict NA: see na.pass.

ranef

logical scalar or matrix indicating whether prediction should be based on random effects. See predict.olmm.

what

a character specifying the quantities to extract.

details

logical scalar. Whether detail results like coefficient constancy tests or loss minimizing grid search should be shown.

...

Additional arguments passed to the calls.

Details

The predict function has two additional options for the type argument. The option "node" calls the node id and "coef" predicts the coefficients corresponding to an observation. In cases of multiple vc terms for the same predictor, the coefficients are summed up.

The splitpath function allows to backtrack the partitioning procedure. By default, it shows which split was chosen in the first iteration. The interesting iteration(s) can be selected by the steps argument. With details = TRUE it is also possible to backtrack the coefficient constancy tests and/or the loss reduction statistics.

summary computes summary statistics of the fitted model, including the estimated coefficients. The varying coefficient are printed by means of a printed decision tree. Notice that in cases there is no split for the varying coefficient, the average coefficient will be among the fixed effects.

Further undocumented, available methods are: fitted, formula, getCall, logLik, model.frame, nobs, print, ranef, resid, and weights. All these methods have the same arguments as the corresponding default methods.

Author(s)

Reto Buergin

See Also

tvcm, tvcm-assessment, tvcm-plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## ------------------------------------------------------------------- #
## Dummy example:
##
## Apply various methods on a 'tvcm' object fitted on the 'vcrpart_2'
## data. Cross-validation is omitted to accelerate the computations.
## ------------------------------------------------------------------- #

data(vcrpart_2)

model <- tvcm(y ~ -1 + vc(z1, z2) + vc(z1, z2, by = x1) + x2,
              data = vcrpart_2, family = gaussian(), subset = 1:90,
              control = tvcm_control(cv = FALSE))

coef(model)
extract(model, "selected")
extract(model, "model")
predict(model, newdata = vcrpart_2[91:100,], type = "node")
predict(model, newdata = vcrpart_2[91:100,], type = "response")
splitpath(model, steps = 1)
summary(model, digits = 2)

vcrpart documentation built on May 17, 2021, 3:01 a.m.