calWt {ClinicalUtilityRecal}R Documentation

Calibration Weights

Description

Calculates observation weights used for weighted calibration method using LOESS smoother. Observations with predicted risks outside clinically relevant interval [Rl,Ru] are downweighted.

Usage

calWt(rl,ru,p,y,r,lambda,delta,returnSmoothedEvent=FALSE)

Arguments

rl

Lower bound of clinically relevant region

ru

Upper bound of clinically relevant region

p

Vector of risk score values

y

Vector of binary outcomes, with 1 indicating event (cases) and 0 indicating no event (controls)

r

Clinically relevant risk threshold

lambda

Tuning parameter for weights inside relevant region

delta

Weight assigned to observations outside relevant region

returnSmoothedEvent

If TRUE returns smoothed observed event rate used for calculationg weights

Details

Computes observation weights for weighted recalibration method. Observations with risk scores near a pre-defined clinically relevant risk threshold r are given weights near 1, while observations far from the risk threshold are down-weighted.

For observations with risk scores within a pre-defined clinically relevant region [R_l, R_u], the weighting function follows an exponential decay form with observations recieving smaller weights as they move farther from the clincally relevant risk threhsold. Distance is measured by the squared difference between the risk threshold and o(p_i), where o(p_i) isa smoothed observed event rate,obtained via LOESS regression of y on the risk scores p_i.

The amount of decay is set by the tuning parameter λ, with larger lambda indicating little down-weighting applied. For observations outside the clinically relevant risk interval, a weight of delta is assigned. An indicator type weight can be choosen by select large λ (e.g λ=10). Clinically relevant region can be [R_l, R_u] = [-∞,], and in these cases it is not necessary to specify delta. See Mishra et al (2020) for functional form of weights and more details.

Value

wt

Vector of weights, between 0 and 1, to be used for weighted recalibration

o

Vector of smoothed observed event rates

Author(s)

Anu Mishra

References

Mishra, A. (2019). Methods for Risk Markers that Incorporate Clinical Utility (Doctoral dissertation). (Available Upon Request)

See Also

wtRecal

Examples

#load data
data(fakeData)

#exponential decay type weight
expWt <- calWt(rl=-Inf,ru=Inf,p=fakeData$p,y=fakeData$y,r=0.2,
                lambda=0.05,delta=0.2,returnSmoothedEvent = TRUE)
plot(expWt$o,expWt$wt,xlab="Smoothed Observed Event Rate",
     ylab="Calibration Weight",ylim=c(0,1))


#indicator type weight
indWt <- calWt(rl=0.1,ru=0.3,p=fakeData$p,y=fakeData$y,r=0.2,
                lambda=0.05,delta=0.2,returnSmoothedEvent = TRUE)
plot(indWt$o,indWt$wt,xlab="Smoothed Observed Event Rate",
    ylab="Calibration Weight",ylim=c(0,1))

[Package ClinicalUtilityRecal version 0.1.0 Index]