Learn R Programming

greyzoneSurv (version 1.0)

bestcut2: Find an Optimal Cutoff for the 2-group Model

Description

This function uses a brute force method to search for the best cutoff value for a marker based on the log rank test to divide patients into high and low risk groups given survival data.

Usage

bestcut2(data, stime, sind, var, leave = 20)

Arguments

data
A data frame or numerical matrix
stime
A character string that tells the column name for survival time in the data
sind
A character string that tells the column name for censoring indicator in the data
var
A character string that tells the column name for marker values in the data
leave
Minimum number of patients in the resulting high and low risk groups

Value

It returns a data frame with the input data as well as the final optimal high and low risk groupings saved in the column bestcut2 (1=high risk and 0=low risk). Additionally, it has columns such as the cutoff value for the marker, the chi-square statistics and the log rank p values for testing equality of survival in the resulting high and low risk groups from using each possible marker value as cutoff.

Examples

Run this code
## Use the package data "mydata" to fit the 2-group model
data(mydata)
res=bestcut2(data=mydata, stime='time', sind='event', var='x')
table(res[,'bestcut2'])

#compare the true groupings and that from the 2-group model
table(res[,c('xhigh', 'bestcut2')]) 

Run the code above in your browser using DataLab