close Warning: Can't synchronize with repository "(default)" (/var/svn/mms does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 14 years ago

Closed 13 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 14 years ago by Pedro Gea

Resolution: fixed
Status: newclosed

(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

comment:2 Changed 14 years ago by atorre

Resolution: fixed
Status: closedreopened

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:3 Changed 14 years ago by atorre

sensitive: 0

¿¿¿Para cuándo el estadístico suma???

:)

comment:4 Changed 13 years ago by Pedro Gea

(In [2833]) Se incorpora el estadístico suma y se añade la opción de menú contextual a las m-variables.
Refs #547

comment:5 Changed 13 years ago by Pedro Gea

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.