# Changeset 589

Ignore:
Timestamp:
Aug 24, 2006, 1:08:40 PM (15 years ago)
Message:

closes #79 and cleaned up code

Location:
trunk/c++_tools/statistics
Files:
4 edited

Unmodified
Added
Removed

 r582 /// the more precise is is assumed to be, or more formally the /// weight is proportional to the reciprocal variance /// \f$\sigma_i^2 = \frac{\sigma^2}{w_i} \f$. 2) Probablity weights /// \f$\sigma_i^2 = \frac{\sigma^2}{w_i} \f$. 2) Probability weights /// are used for the situation when calculating averages over a /// distribution \f$f \f$ , but sampling from a distribution \f$f' /// /// @brief Weighted version of number of data points. If all /// weights are equal, the unweighted version is identical to the /// non-weighted version. Adding a data point with zero weight /// does not change n(). The calculated value is always smaller /// than the actual number of data points added to object. /// /// @return \f$ \frac{\left(\sum w_i\right)^2}{\sum w_i^2} \f$/// • ## trunk/c++_tools/statistics/ROC.h  r509 /// Class for ROC (Reciever Operating Characteristic). /// /// As the area under an ROC curve is equivalent to Mann-Whitney U /// statistica, this class can be used to perform a Mann-Whitney /// U-test (aka Wilcoxon). /// class ROC : public Score { • ## trunk/c++_tools/statistics/tScore.cc  r532 double s2=(positive.sum_xx_centered()+negative.sum_xx_centered())/dof_; t_=diff/sqrt(s2*(1.0/positive.n()+1.0/negative.n())); t_=diff/sqrt(s2/positive.n()+s2/negative.n()); if (t_<0 && absolute_) t_=-t_; } double diff = positive.mean() - negative.mean(); dof_=positive.sum_w()*positive.sum_w()/positive.sum_ww() + negative.sum_w()*negative.sum_w()/negative.sum_ww(); dof_=positive.n()+negative.n()-2; double s2=(positive.sum_xx_centered()+negative.sum_xx_centered())/dof_; t_=diff/sqrt(s2*(1.0/(positive.sum_w()*positive.sum_w()/positive.sum_ww())+ 1.0/(negative.sum_w()*negative.sum_w()/negative.sum_ww()))); t_=diff/sqrt(s2/positive.n()+s2/(negative.n())); if (t_<0 && absolute_) t_=-t_; • ## trunk/c++_tools/statistics/tScore.h  r532 /// Class for Fisher's t-test. /// /// See /// http://en.wikipedia.org/wiki/Student's_t-test for more /// details on the t-test. /// class tScore : public Score { /// Calculates the value of t-score, i.e. the ratio between /// difference in mean and standard deviation of this /// difference. \f$ \frac{ \vert \frac{1}{n_x}\sum x_i - /// \frac{1}{n_y}\sum y_i \vert } {\frac{\sum (x_i-m_x)^2 + \sum /// (y_i-m_y)^2}{n_x-1+n_y-1}} \f$/// difference. \f$ t = \frac{ m_x - m_y } /// {\frac{s^2}{n_x}+\frac{s^2}{n_y}} \f$where \f$ m \f$is the /// mean, \f$ n \f$is the number of data points and \f$ s^2 = /// \frac{ \sum_i (x_i-m_x)^2 + \sum_i (y_i-m_y)^2 }{ n_x + n_y - /// 2 } /// /// @return t-score if absolute=true /// absolute value of t-score is returned /// @return t-score if absolute=true absolute value of t-score /// is returned /// double score(const classifier::Target& target, /// /// Weighted version of t-Score @return t-score if absolute=true /// absolute value of t-score is returned. /// Calculates the weighted t-score, i.e. the ratio between /// difference in mean and standard deviation of this /// difference. \f$t = \frac{ m_x - m_y } { /// \frac{s2}{n_x}+\frac{s2}{n_y} \f$ where \f$m \f$ is the /// weighted mean, n is the weighted version of number of data /// points and \f$s2 \f$ is an estimation of the variance \f$s^2 /// = \frac{ \sum_i w_i(x_i-m_x)^2 + \sum_i w_i(y_i-m_y)^2 }{ n_x /// + n_y - 2 } \f$. See AveragerWeighted for details. /// /// @todo document /// @return t-score if absolute=true absolute value of t-score /// is returned /// double score(const classifier::Target& target, /// ///Calculates the p-value, i.e. the probability of observing a ///t-score equally or larger if the null hypothesis is true. If P ///is near zero, this casts doubt on this hypothesis. The null ///hypothesis is ...  @return the one-sided p-value( if ///absolute=true is used the two-sided p-value) /// Calculates the p-value, i.e. the probability of observing a /// t-score equally or larger if the null hypothesis is true. If P /// is near zero, this casts doubt on this hypothesis. The null /// hypothesis is that the means of the two distributions are /// equal. Assumtions for this test is that the two distributions /// are normal distributions with equal variance. The latter /// assumtion is dropped in Welch's t-test. /// /// @return the one-sided p-value( if absolute=true is used /// the two-sided p-value) /// double p_value() const;
Note: See TracChangeset for help on using the changeset viewer.