This may be somewhat useful, but I might have more later.
http://florence.acadiau.ca/collab/hugh_public/index.php?title=R:CheckBinFit

(the code below is copied from the URL above)

CheckBinFit <- function(y,phat,nq=20,new=T,...) {
    if(is.factor(y)) y <- as.double(y)
    y <- y-mean(y)
    y[y>0] <- 1
    y[y<=0] <- 0
    quants <- quantile(phat,probs=(1:nq)/(nq+1))
    names(quants) <- NULL
    quants <- c(0,quants,1)
        phatD <- rep(0,nq+1)
    phatF <- rep(0,nq+1)
    for(i in 1:(nq+1))
    {
        which <- ((phat<=quants[i+1])&(phat>quants[i]))
        phatF[i] <- mean(phat[which])
        phatD[i] <- mean(y[which])
    }
    if (new) plot(phatF,phatD,xlab="phat",ylab="data",
          main=paste('R^2=',cor(phatF,phatD)^2),...)
    else points(phatF,phatD,...)
    abline(0,1)
    return(invisible(list(phat=phatF,data=phatD)))
}



On Thu, Mar 12, 2009 at 1:30 PM, Eric Siegel <e...@predictionimpact.com>wrote:

> Hi all,
>
> I'd like to do cross-validation on lm and get the resulting lift
> curve/table
> (or, alternatively, the estimates on 100% of my data with which I can get
> lift).
>
> If such a thing doesn't exist, could it be derived using cv.lm, or would we
> need to start from scratch?
>
> Thanks!
>
> --
> Eric Siegel, Ph.D.
> President
> Prediction Impact, Inc.
>
> Predictive Analytics World Conference
> More info: www.predictiveanalyticsworld.com
> LinkedIn Group: www.linkedin.com/e/gis/1005097
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to