[R] reclassification table

Miroslav Stojadinovic
Tue, 30 Jul 2013 14:18:01 -0000

Hi all,

      I am trying to build reclassification table, net reclassification
improvement ...using PredictAbel in R version 2.15.1 or 3. However when I try to
obtain reclassification table I get an error. A sample session is reproduced
below.




> str(nrii)

'data.frame':   213 obs. of  3 variables:

 $ hidr: num  0 1 0 0 0 2 1 1 2 2 ...

 $ isln: num  0 1 0 1 0 1 1 1 1 1 ...

 $ ctln: num  0 1 0 1 0 1 1 1 1 1 ...

> cOutcome <- 2

> cNonGenPred1 <- c(3)

> cNonGenPred2 <- c(3)

> cNonGenPredCat1 <- c(0)

> cNonGenPredCat2 <- c(0)

> cGenPred1 <- c(0)

> cGenPred2 <- c(1)

> cGenPredsCat1 <- c(0)

> cGenPredsCat2 <- c(0)

> riskmodel1 <- fitLogRegModel(data=nrii,cOutcome=cOutcome,

+ cNonGenPreds=cNonGenPred1, cNonGenPredsCat=cNonGenPredCat1,

+ cGenPreds=cGenPred1, cGenPredsCat=cGenPredsCat1)

> riskmodel2 <- fitLogRegModel(data=nrii,cOutcome=cOutcome,

+ cNonGenPreds=cNonGenPred2, cNonGenPredsCat=cNonGenPredCat2,

+ cGenPreds=cGenPred2, cGenPredsCat=cGenPredsCat2)

> ExampleModels <- list(riskModel1=riskmodel1, riskModel2=riskmodel2)

> riskmodel1 <- ExampleModels()$riskModel1

> riskmodel2 <- ExampleModels()$riskModel2

> predRisk1 <- predRisk(riskmodel1)

> predRisk2 <- predRisk(riskmodel2)

> cutoff <- c(0,.20,.60,1)

>
reclassification(data=nrii,cOutcome=cOutcome,predrisk1=predRisk1,predrisk2=predRisk2,cutoff)

 _________________________________________



     Reclassification table

 _________________________________________

Error in table(c1, c2, data[, cOutcome]) :

  all arguments must have the same length

>

Any help will be appreciated.

Thanks.

Miroslav Stojadinovic

	[[alternative HTML version deleted]]