#ifndef _theplu_yat_regression_naive_ #define _theplu_yat_regression_naive_ // $Id: Naive.h 1487 2008-09-10 08:41:36Z jari$ /* Copyright (C) 2004 Peter Johansson Copyright (C) 2005, 2006, 2007 Jari H‰kkinen, Peter Johansson Copyright (C) 2008 Peter Johansson This file is part of the yat library, http://dev.thep.lu.se/yat The yat library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The yat library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with yat. If not, see . */ #include "OneDimensional.h" #include #include namespace theplu { namespace yat { namespace utility { class VectorBase; } namespace regression { /** @brief Naive Regression Data are modeled as \f$y_i = \alpha + \epsilon_i \f$ */ class Naive : public OneDimensional { public: /// /// @brief The default constructor /// Naive(void); /// /// @brief The destructor /// virtual ~Naive(void); /// /// This function computes the best-fit for the naive model \f$y /// = m \f$ from vectors \a x and \a y, by minimizing \f$/// \sum{(y_i-m)^2} \f$. /// void fit(const utility::VectorBase& x, const utility::VectorBase& y); /// /// The predicted value is the average \f$m \f$ /// double predict(const double x) const; /** \f$\frac{\sum \epsilon_i^2}{N-1} \f$ @return Conditional variance */ double s2(void) const; /// /// \f$\frac{s^2}{N} \f$ /// /// @return squared standard error /// /// @see statistics::Averager /// double standard_error2(const double x) const; private: /// /// @brief The copy constructor (not implemented). /// Naive(const Naive&); double mse_; }; }}} // of namespaces regression, yat, and theplu #endif