predict.nft2: Drawing Posterior Predictive Realizations for NFT BART...

View source: R/predict.nft2.R

predict.nft2R Documentation

Drawing Posterior Predictive Realizations for NFT BART models.

Description

The function predict.nft2()/predict.nft() is the main function for drawing posterior predictive realizations at new inputs using a fitted model stored in a nft2/nft object returned from nft2()/nft().

Usage

## S3 method for class 'nft2'
predict(
            ## data
            object,
            xftest=object$xftrain,
            xstest=object$xstrain,
            ## multi-threading
            tc=getOption("mc.cores", 1), ##OpenMP thread count
            ## current process fit vs. previous process fit
            XPtr=TRUE,
            ## predictions
            K=0,
            events=object$events,
            FPD=FALSE,
            probs=c(0.025, 0.975),
            take.logs=TRUE,
            na.rm=FALSE,
            seed=NULL,
            ## default settings for NFT:BART/HBART/DPM
            fmu=object$NFT$fmu,
            soffset=object$soffset,
            drawDPM=object$drawDPM,
            ## etc.
            ...)

## S3 method for class 'nft'
predict(
            ## data
            object,
            x.test=object$x.train,
            ## multi-threading
            tc=getOption("mc.cores", 1), ##OpenMP thread count
            ## current process fit vs. previous process fit
            XPtr=TRUE,
            ## predictions
            K=0,
            events=object$events,
            FPD=FALSE,
            probs=c(0.025, 0.975),
            take.logs=TRUE,
            na.rm=FALSE,
            seed=NULL,
            ## default settings for NFT:BART/HBART/DPM
            fmu=object$NFT$fmu,
            soffset=object$soffset,
            drawDPM=object$drawDPM,
            ## etc.
            ...)

Arguments

object

Object of type nft2/nft from a previous call to nft2()/nft().

xftest,xstest,x.test

New input settings in the form of a matrix at which to construct predictions. Defaults to the training inputs.

tc

Number of OpenMP threads to use for parallel computing.

XPtr

If object was created during the currently running R process, then (via an Rcpp XPtr) the BART/HBART tree ensemble objects can be accessed in RAM; otherwise, those objects will need to be loaded from their string encodings.

K

The length of the grid of time-points to be used for survival predictions. Set to zero to avoid these calculations which can be time-consuming for large data sets.

events

You can specify the grid of time-points; otherwise, they are derived from quantiles of the augmented event times.

FPD

Whether to yield the usual predictions or marginal predictions calculated by the partial dependence function.

probs

A vector of length two containing the lower and upper quantiles to be calculated for the predictions.

take.logs

Whether or not to take logarithms.

na.rm

Whether NA values should be removed from the summaries.

seed

If provided, then this value is used to generate random natural logarithms of event times from the predictive distribution.

fmu

BART centering parameter for the test data. Defaults to the value used by nft2()/nft() when training the model.

soffset

HBART centering parameter for the test data. Defaults to the value used by nft2()/nft() when training the model.

drawDPM

Whether NFT BART was fit with, or without, DPM.

...

The et cetera objects passed to the predict method. Currently, it has no functionality.

Details

predict.nft2()/predict.nft() is the main function for calculating posterior predictions and uncertainties once a model has been fit by nft2()/nft().

Returns a list with the following entries.

Value

f.test

Posterior realizations of the mean function stored in a matrix. Omitted if partial dependence functions are performed since these will typically be large.

s.test

Posterior realizations of the SD function stored in a matrix. Omitted if partial dependence functions are performed since these will typically be large.

f.test.mean

Posterior predictive mean of mean function.

f.test.lower

Posterior predictive lower quantile of mean function.

f.test.upper

Posterior predictive upper quantile of mean function.

s.test.mean

Posterior predictive mean of SD function.

s.test.lower

Posterior predictive lower quantile of SD function.

s.test.upper

Posterior predictive upper quantile of SD function.

surv.fpd

Survival function posterior draws on a grid of time-points by the partial dependence function when requested.

surv.fpd.mean

Survival function estimates on a grid of time-points by the partial dependence function when requested.

surv.fpd.lower

Survival function lower quantiles on a grid of time-points by the partial dependence function when requested.

surv.fpd.upper

Survival function upper quantiles on a grid of time-points by the partial dependence function when requested.

Author(s)

Rodney Sparapani: rsparapa@mcw.edu

See Also

nft2, nft


nftbart documentation built on May 1, 2023, 1:08 a.m.