# source:trunk/yat/regression/NegativeBinomial.h@3614

Last change on this file since 3614 was 3614, checked in by Peter, 6 years ago

refs #867 and #882. Interface for Negative Binomiual and Poisson regression

• Property svn:eol-style set to native
• Property svn:keywords set to Id
File size: 1.7 KB
Line
1#ifndef theplu_yat_regression_negative_binomial
2#define theplu_yat_regression_negative_binomial
3
4// $Id: NegativeBinomial.h 3614 2017-02-06 01:37:33Z peter$
5
6/*
7  Copyright (C) 2017 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <yat/utility/Matrix.h>
26#include <yat/utility/Vector.h>
27
28namespace theplu {
29namespace yat {
30namespace regression {
31
32  /**
33     Models count data from a negative binomial distribution
34     \f$y \in NB(m(x)) \f$ in which the the expectation value, \f$m 35 \f$ is modeled as \f$log(m) = \Beta_0 + \Beta_1 x_1 + ... + 36 \Beta_p x_p \f$, or for a given model, \f$\Beta \f$, and input
37     vector \f$x \f$, the expectation value \f$E(Y | x, \Beta) = 38 \exp(\Beta'x) \f$
39
40     \since new in yat 0.15
41   */
42  class NegativeBinomial
43  {
44  public:
45    /**
46       \brief fit model parameters
47     */
48    void fit(const utility::Matrix& x, const utility::VectorBase& y);
49
50    /**
51       \return model parameters
52     */
53    const utility::Vector& fit_parameters(void) const;
54
55    /**
56       Predicted value given \a x. The prediction is calculated as
57       \f$\exp{\beta_0 + \beta_1 x_1 +...+\beta_p x_p} \f$
58     */
59    double predict(const utility::VectorBase& x) const;
60  };
61
62}}}
63
64#endif
Note: See TracBrowser for help on using the repository browser.