[R] Issues while using “lift.chart” and “adjProbScore” function from ”BCA” library

aajit75 aajit75 at yahoo.co.in
Thu May 24 06:31:31 CEST 2012


Dear List,

Couple of issues while using functions from “BCA” library:

1. I am trying to use “lift.chart” function from “BCA” library, but facing
issues while using model where model formula is passed as formula object in
glm.

When model formula is written as text, then it works fine. In my case input
variables and target variables are going to change dynamically, so have to
used formula as formula object as derived.

Below is the sample code, taken from the package document to illustrate the
issues

library(BCA)
data(CCS)
CCS$Sample <- create.samples(CCS, est=0.4, val=0.4)
CCSEst <- CCS[CCS$Sample == "Estimation",]

#Fit glm model with formula written as text

CCS.glm <- glm(MonthGive ~ DonPerYear + LastDonAmt + Region + YearsGive,
family=binomial(logit), data=CCSEst)

CCSVal <- CCS[CCS$Sample == "Validation",]

lift.chart(c("CCS.glm"), data=CCSVal, targLevel="Yes",
trueResp=0.01, type="incremental", sub="Validation")


#Fit glm model with formula passed as formula object

fm <- as.formula("MonthGive ~ DonPerYear + LastDonAmt + Region + YearsGive")

CCS.glm12 <- glm(fm,family=binomial(logit), data=CCSEst)

lift.chart(c("CCS.glm12"), data=CCSVal, targLevel="Yes",
trueResp=0.01, type="incremental", sub="Validation")

Following error occurs,
Error in if (any(yvar1 != yvar1[1])) { : 
  missing value where TRUE/FALSE needed

Is there any way out to use formula object in the model and using
“lift.chart” function

2. Issue using “adjProbScore” function from the “BCA” library.

(adjProbScore(model="CCS.glm", data=CCSVal1, targLevel="Yes",
trueResp=0.01))

Error in parse(text = paste("as.character(", ActiveDataSet(), "$", yvar,  : 
  <text>:1:16: unexpected '$'
1: as.character(  $
                  ^
Above error is thrown, am I doing anything wrong? Please correct.
Also, as in the case-1 above, can we use model fitted with formula object in
“adjProbScore” function.

Thanks in advance!
Ajit


--
View this message in context: http://r.789695.n4.nabble.com/Issues-while-using-lift-chart-and-adjProbScore-function-from-BCA-library-tp4631158.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list