# Changeset 727 for trunk/yat/regression

Ignore:
Timestamp:
Jan 4, 2007, 4:06:14 PM (16 years ago)
Message:

fixes #177

Location:
trunk/yat/regression
Files:
10 edited

Unmodified
Removed
• ## trunk/yat/regression/Linear.cc

 r726 } double Linear::standard_error(const double x) const double Linear::standard_error2(const double x) const { return sqrt( alpha_var_+beta_var_*(x-ap_.x_averager().mean())* (x-ap_.x_averager().mean()) ); return alpha_var_+beta_var_*(x-ap_.x_averager().mean())* (x-ap_.x_averager().mean()); }
• ## trunk/yat/regression/Linear.h

 r726 /** The error of the model is estimated as \f$\sqrt{ \textrm{alpha\_err}^2+\textrm{beta\_err}^2*(x-m_x)*(x-m_x)}\f$ The error of the model is estimated as \f$\textrm{alpha\_err}^2+\textrm{beta\_err}^2*(x-m_x)*(x-m_x)\f$ @return estimated error of model in @a x */ double standard_error(const double x) const; double standard_error2(const double x) const;
• ## trunk/yat/regression/MultiDimensional.cc

 r726 double MultiDimensional::prediction_error(const utility::vector& x) const double MultiDimensional::prediction_error2(const utility::vector& x) const { return standard_error2(x)+chisquare_; } double MultiDimensional::standard_error2(const utility::vector& x) const { double s2 = 0; s2 += 2*covariance_(i,j)*x(i)*x(j); } return sqrt(s2+chisquare_); } double MultiDimensional::standard_error(const utility::vector& x) const { double s2 = 0; for (size_t i=0; i
• ## trunk/yat/regression/MultiDimensional.h

 r726 /// /// @return expected prediction error for a new data point in @a x /// @return expected squared prediction error for a new data point /// in @a x /// double prediction_error(const utility::vector& x) const; double prediction_error2(const utility::vector& x) const; /// /// @return error of model value in @a x /// @return squared error of model value in @a x /// double standard_error(const utility::vector& x) const; double standard_error2(const utility::vector& x) const; private:
• ## trunk/yat/regression/Naive.cc

 r726 double Naive::standard_error(const double x) const double Naive::standard_error2(const double x) const { return ap_.y_averager().standard_error(); return chisq()/ap_.n()/(ap_.n()-1); }
• ## trunk/yat/regression/Naive.h

 r726 /// @see statistics::Averager /// double standard_error(const double x) const; double standard_error2(const double x) const; private:
• ## trunk/yat/regression/OneDimensional.cc

 r718 double OneDimensional::prediction_error(const double x) const double OneDimensional::prediction_error2(const double x) const { return sqrt(chisq()+pow(standard_error(x),2)); return chisq()+standard_error2(x); } for ( double x=min; x<=max; x+=dx) { double y = predict(x); double y_err = prediction_error(x); double y_err = sqrt(prediction_error2(x)); os << x << "\t" << y << "\t" << y_err << "\n"; }
• ## trunk/yat/regression/OneDimensional.h

 r726 /** This function computes the best-fit given a model (see specific class for details) by minimizing \f$\sum{(\hat{y_i}-y_i)^2} \f$, where \f$\hat{y} \f$ is the fitted value. This function computes the best-fit given a model (see specific class for details) by minimizing \f$\sum{(\hat{y_i}-y_i)^2} \f$, where \f$\hat{y} \f$ is the fitted value. */ virtual void fit(const utility::vector& x, const utility::vector& y)=0; /** The prediction error is defined as the square root of the expected squared deviation a new data point will have from value the model provides. The expected squared deviation is defined as \f$E(Y|x - \hat{y}(x))^2 \f$ and is typically The prediction error is defined as the expected squared deviation a new data point will have from value the model provides: \f$E(Y|x - \hat{y}(x))^2 \f$ and is typically divided into two terms \f$E(Y|x - E(Y|x))^2 \f$ and \f$E(E(Y|x) - \hat{y}(x))^2 \f$, which is the conditional variance given \f$x \f$ and the squared standard error (see standard_error()) of the model estimation in \f$x \f$, standard_error2()) of the model estimation in \f$x \f$, respectively. @return expected prediction error for a new data point in @a x @return expected squared prediction error for a new data point in @a x */ double prediction_error(const double x) const; double prediction_error2(const double x) const; /// /** The standard error is defined as \f$\sqrt{E(Y|x - \hat{y}(x))^2 }\f$ The standard error is defined as \f$E(Y|x - \hat{y}(x))^2 \f$ @return expected error of model value in @a x @return expected squared error of model value in @a x */ virtual double standard_error(const double x) const=0; virtual double standard_error2(const double x) const=0; protected:
• ## trunk/yat/regression/Polynomial.cc

 r726 double Polynomial::standard_error(const double x) const double Polynomial::standard_error2(const double x) const { utility::vector vec(power_+1,1); for (size_t i=1; i<=power_; ++i) vec(i) = vec(i-1)*x; return md_.standard_error(vec); return md_.standard_error2(vec); }
• ## trunk/yat/regression/Polynomial.h

 r726 /// /// @return error of model value in @a x /// @return squared error of model value in @a x /// double standard_error(const double x) const; double standard_error2(const double x) const; private:
Note: See TracChangeset for help on using the changeset viewer.