Opened 15 years ago
Closed 14 years ago
#547 closed enhancement (fixed)
Mostrar un informe con estadísticos de las variables
| Reported by: | Pedro Gea | Owned by: | Pedro Gea |
|---|---|---|---|
| Priority: | major | Milestone: | Release 0.6 |
| Component: | General | Keywords: | |
| Cc: |
Description
Extraido de #374.
Echo en falta el acceso rápido a las estadísticas básicas de cada variable. He hecho algunas funciones que, creo, se podrían añadir como métodos de objetos y como opciones de botón derecho.
Las funciones para MMS, serían:
// Para acceder a las estadísticas de una variable
Set VarStat(NameBlock var)
{
Text name = var::GetName(?);
Text gram = var::GetGrammar(?);
Set stat = Case(
gram == "Matrix", ColStat(var::GetData(?)),
gram == "Serie", SerStat(var::GetData(?)),
1,
{
WriteLn("VarStat:\n gramatica "+ name +" desconocida para la variable "+
name, "E");
Copy(Empty)
});
[[ name ]] << stat
};
// Para acceder a las estadísticas de todas las variables de un DataSet
Set DataSet_VarStat(NameBlock dataSet)
{
Set sStat = EvalSet(dataSet::GetVariables(?), Set(NameBlock var)
{
VarStat(var)
});
Eval("Set "+ dataSet::GetIdentifier(?) +".stat = sStat;")
};
// Las funciones que devuelven los estadísticos:
//////////////////////////////////////////////////////////////////////////////
Set ColStat(Matrix mat)
//////////////////////////////////////////////////////////////////////////////
{
Real row = Rows(mat);
Matrix matCol = SubCol(mat, [[ 1 ]]);
Real num = row;
Real avr = MatAvr(matCol);
Real sum = MatSum(matCol);
Real stD = MatStDs(matCol);
Real min = MatMin(matCol);
Real max = MatMax(matCol);
Real unk = MatSum(IsUnknown(matCol));
Text name = Name(mat);
Text name2Show = If(name == "", "colStat", name);
Eval("Set "+ name2Show+" = [[ num, avr, sum, stD, min, max, unk ]];")
};
//////////////////////////////////////////////////////////////////////////////
PutDescription("
Devuelve un conjunto de estadisticos para la primera columna de una matriz.",
ColStat);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set SerStat(Serie ser)
//////////////////////////////////////////////////////////////////////////////
{
Real num = CountS(ser);
Real avr = AvrS(ser);
Real sum = SumS(ser);
Real stD = StDsS(ser);
Real min = MinS(ser);
Real max = MaxS(ser);
Real unk = SumS(IsUnknown(ser));
Text name = Name(ser);
Text name2Show = If(name == "", "serStat", name +".Stat");
Eval("Set "+ name2Show +" = [[ num, avr, sum, stD, min, max, unk ]];")
};
//////////////////////////////////////////////////////////////////////////////
PutDescription("
Devuelve un conjunto de estadisticos para una serie.",
SerStat);
//////////////////////////////////////////////////////////////////////////////
Change History (5)
comment:1 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 Changed 14 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Muchas gracias. Ayuda mucho.
Un par de comentarios adicionales:
.- echo de menos el estadístico suma.
.- ¿se podría aplicar también a las variables del modelo?
comment:4 Changed 14 years ago by
comment:5 Changed 14 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](/mms/chrome/site/logomms.png)
(In [2309]) Se introduce un método para obtener algunos estadísticos de los datos de una variable.
Se añade también una opción de menú contextual para su acceso.
Closes #547