discretizeAge {TCPMOR} | R Documentation |
Discretize the age variable according to the two cut-off points
discretizeAge(data, cutoffs)
data |
Data frame with column: age |
cutoffs |
The cut-off points of the age range |
A modified data frame with a new column: age_p
# Generate simulated data dataC
dataC <- createData(200)
# Fit the semi-parametric model
spm.fit <- fitSemiParamModel(dataC)
# Find two cut-off points
dataC <- findCutoffs(spm.fit, dataC)
# Calculate the two cut-off points after limiting sensitivity se and specificity sp
result <- calculateCutoffs(dataC)
cutoffs <- result$cutoffs
dataC2 <- result$filteredData
# Discretize age variable based on the two cutoffs
dataC2 <- discretizeAge(dataC2, cutoffs)