Opened 14 years ago
Closed 13 years ago
#702 closed enhancement (fixed)
Estadísticos de resultados de modelos de respuesta cualitativa (Logit, Probit)
| Reported by: | imendez | Owned by: | mafernandez |
|---|---|---|---|
| Priority: | major | Milestone: | Development 1A |
| Component: | General | Keywords: | |
| Cc: |
Description
Hola, solicito que se añadan a los resultados de una estimación de un modelo de respuesta cualitativa un conjunto con los siguientes estadísticos:
- Área bajo la curva ROC (éste creo que ya se solicita en #347)
- Índice KS
- Índice de Gini
Al igual que en #346 y #347, creo que su cálculo se debería controlar mediante un parámetro de configuración de la estimación (_.DoStatistics).
El siguiente código puede ser útil (calcula el Gini a partir del AUC, no directamente; esto puede ser bueno/rápido si ya se ha calculado el AUC):
//////////////////////////////////////////////////////////////////////////////
Real AUCRoc(Set tasasROC, Set methodInterp)
//////////////////////////////////////////////////////////////////////////////
{
Set aux = Extract(tasasROC,1,2);
Set claTFP = Classify(aux, Real(Set reg1, Set reg2)
{
Real tfp1 = reg1[1];
Real tfp2 = reg2[1];
Compare(tfp1, tfp2)
});
Set graph = EvalSet(claTFP, Set(Set class)
{
Real maxTvp = SetMax(Traspose(class)[2]);
Select(class, Real(Set reg){EQ(reg[2], maxTvp)})[1]
});
Set tasasROCUnique = Extract(graph,1,2);
If(Card(tasasROCUnique)>2,
{
Set txFP = Traspose(tasasROCUnique)[1];
Set txVP = Traspose(tasasROCUnique)[2];
Set setFunSet = SetOfSet(Traspose(SetOfSet(txFP, txVP)) );
Real get.tvp(Real tfp)
{
Set tfpSet = SetOfReal(tfp);
Real tvp = Interp(tfpSet, setFunSet, methodInterp)[1][2];
tvp
};
IntegrateQAG(get.tvp, 0, 1)
},
{
WriteLn("Intervalos insuficientes para calcular AUC","W");
0
})
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Calcula los valores area ROC (AUC) dado las tasas de aciertos de un modelo
(TFP, TVP,TVN,TFN)",
AUCRoc);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real GiniRoc(Set tasasROC, Set methodInterp)
//////////////////////////////////////////////////////////////////////////////
{ 2*AUCRoc(tasasROC, methodInterp) - 1 };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Calcula el indice de GINI dado las tasas de aciertos ROC de un modelo
(TFP, TVP,TVN,TFN)",
GiniRoc);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real KSRoc(Set tasasROC, Set methodInterp)
//////////////////////////////////////////////////////////////////////////////
{
Set aux = Extract(tasasROC,1,2);
Set claTFP = Classify(aux, Real(Set reg1, Set reg2)
{
Real tfp1 = reg1[1];
Real tfp2 = reg2[1];
Compare(tfp1, tfp2)
});
Set graph = EvalSet(claTFP, Set(Set class)
{
Real maxTvp = SetMax(Traspose(class)[2]);
Select(class, Real(Set reg){EQ(reg[2], maxTvp)})[1]
});
Set tasasROCUnique = Extract(graph,1,2);
Set txFP = Traspose(tasasROCUnique)[1];
Set txVP = Traspose(tasasROCUnique)[2];
Set setFunSet = SetOfSet(Traspose(SetOfSet(txFP, txVP)) );
Real get.tvp(Real tfp)
{
Set tfpSet = SetOfReal(tfp);
Real tvp = Interp(tfpSet, setFunSet, methodInterp)[1][2];
tvp
};
Set curvasROC = EvalSet(Range(0,1,0.0001), Set (Real k){
[[k, get.tvp(k)]]
});
Matrix yTvp = SetMat(Extract(curvasROC,2));
Matrix yTfp = SetMat(Extract(curvasROC,1));
Real IndKs = MatMax(yTvp-yTfp)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Calcula el indice Kolmogorov Smirnov ROC dado las tasas de aciertos de
un modelo (TFP, TVP,TVN,TFN)",
KSRoc);
//////////////////////////////////////////////////////////////////////////////
Change History (2)
comment:1 Changed 14 years ago by
| Component: | Results → MmsReports |
|---|---|
| Milestone: | → Development 1A |
| Owner: | changed from Pedro Gea to mafernandez |
| sensitive: | → 0 |
| Summary: | Estádisticos de resultados de modelos de respuesta cualitativa (Logit, Probit) → Estadísticos de resultados de modelos de respuesta cualitativa (Logit, Probit) |
| version: | → 1 |
comment:2 Changed 13 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](/mms/chrome/site/logomms.png)
Véanse #967 y TOL#1350