Bonferroni correction

//*********************************************************************
// statsBC
//
// Shawn Driscoll
// Salk Institute for Biological Studies
//
// Implements Bonferroni correction. With a Family-wise error rate of
// 0.05, the expected number of false positives will be 0.05.
//
// Parameters:
// w - input wave of p-values
//
// Optional Parameters:
// ncol - column number of p-values if input wave w is a 2D matrix
//*********************************************************************
function statsBC(w,[ncol])

    //-----------------------------------------------------------------
    // parameters
    //-----------------------------------------------------------------
    wave w;
    variable ncol;
   
    //-----------------------------------------------------------------
    // variables
    //-----------------------------------------------------------------
    variable npnts,ndim;
   
    //-----------------------------------------------------------------
    // init variables
    //-----------------------------------------------------------------
   
    if(paramIsDefault(ncol))
        ncol = 0;
    endif
   
    npnts = dimsize(w,0);
    ndim = dimsize(w,1);

    //-----------------------------------------------------------------
    // main function
    //-----------------------------------------------------------------
   
    if(ndim)
        w[][ncol] *= npnts;
    else
        w *= npnts;
    endif

    // set p-values greater than 1 to 1
    w[] = w[p] > 1 ? 1 : w[p];

end

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More