R/predict.nftmi.R

Defines functions predict.nftmi

## Copyright (C) 2024 Rodney A. Sparapani

## This file is part of nftbart.
## predict.nftmi.R

## nftbart is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 of the License, or
## (at your option) any later version.

## nftbart is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.

## Author contact information
## Rodney A. Sparapani: rsparapa@mcw.edu

predict.nftmi = function(
                       ## 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,
                       RMST.max=NULL,
                       ##seed=NULL,
                       ## default settings for NFT:BART/HBART/DPM
                       fmu=object$NFT$fmu,
                       soffset=object$soffset,
                       drawDPM=object$drawDPM,
                       ## etc.
                       ...)
{
    if(is.null(object)) stop("No fitted model specified!\n")

    object$xftrain <- object$x.train
    object$xstrain <- object$x.train
    object$xifcuts <- object$xicuts
    object$xiscuts <- object$xicuts

    attr(object, 'class') <- 'nft2mi'

    res <- predict(
                       ## data
                       object,
                       xftest=x.test,
                       xstest=x.test,
                       ## multi-threading
                       tc=tc, ##OpenMP thread count
                       ## current process fit vs. previous process fit
                       XPtr=XPtr,
                       ## predictions
                       K=K,
                       events=events,
                       FPD=FPD,
                       probs=probs,
                       take.logs=take.logs,
                       na.rm=na.rm,
                       RMST.max=RMST.max,
                       ##seed=NULL,
                       ## default settings for NFT:BART/HBART/DPM
                       fmu=fmu,
                       soffset=soffset,
                       drawDPM=drawDPM,
                       ## etc.
                       ...)

    return(res)
}

Try the nftbart package in your browser

Any scripts or data that you put into this service are public.

nftbart documentation built on Dec. 3, 2025, 9:06 a.m.