37#ifndef STK_JOINTGAMMAMODEL_H
38#define STK_JOINTGAMMAMODEL_H
53template <
class Array,
class WColVector = CVectorX>
class ModelGamma_aj_bj;
54struct ModelGamma_aj_bjParameters;
62template<
class Data_,
class WColVector_>
141template <
class Data_,
class WColVector_>
222template<
class Data_,
class WColVector_>
232template<
class Data_,
class WColVector_>
235 for (
int j=p_data()->dataij().beginCols();
j < p_data()->dataij().endCols(); ++
j)
237 mean()[
j] = p_data()->dataij().col(
j).meanSafe();
238 meanLog()[
j] = p_data()->dataij().col(
j).safe(1.).log().mean();
239 variance()[
j] = p_data()->dataij().col(
j).safe().variance();
251template<
class Data_,
class WColVector_>
254 for (
int j=p_data()->dataij().beginCols();
j < p_data()->dataij().endCols(); ++
j)
257 meanLog()[
j] = p_data()->dataij().col(
j).safe(1).log().wmean(
weights);
258 variance()[
j] = p_data()->dataij().col(
j).safe().wvariance(
weights);
271template<
class Data_,
class WColVector_>
274 os <<
_T(
"shape = ") << shape();
275 os <<
_T(
"scale = ") << scale();
A Array2DPoint is a one dimensional horizontal container.
In this file we declare raw the functions.
In this file we define the class IMultiStatModel.
In this file we define the Gamma probability distribution.
In this file we define the constant and utilities methods used in the project Model.
#define _T(x)
Let x unmodified.
Derived & resize(Range const &I, Range const &J)
resize the Array.
Interface base class for functions.
Interface base class for all Multivariate Statistical Models.
Real computeLnLikelihood() const
compute the log Likelihood of the statistical model.
Parameters const & param() const
Data const *const p_data() const
virtual Real lpdf(Real const &x) const
Compute.
dloglikelihood(Real const &mean, Real const &meanLog)
A joint Gamma model is a statistical model of the following form.
void computeParameters()
compute the parameters
ModelGamma_aj_bj()
default constructor.
DataBridge< Data_ > Data
Type of the container storing the data.
void writeParametersImpl(ostream &os) const
Write the parameters on the output stream os.
WColVector_ WColVector
Type of the array storing the weights of the data.
CPointX const & variance() const
vector of the variance of the observations
CPointX const & scale() const
ModelGamma_aj_bj(Data const &data)
Constructor with data set.
hidden::Traits< Data_ >::Row RowVector
CPointX const & meanLog() const
vector of the mean log of the observations
CPointX const & mean() const
ModelGamma_aj_bj(ModelGamma_aj_bj const &model)
Copy constructor.
~ModelGamma_aj_bj()
destructor
ModelGamma_aj_bj(Data const *p_data)
Constructor with a ptr on the data set.
CPointX & meanLog()
vector of the mean log of the observations
CPointX & variance()
vector of the variance of the observations
int computeNbFreeParameters() const
compute the number of free parameters
CPointX const & shape() const
IMultiStatModel< ModelGamma_aj_bj< Data_, WColVector_ > > Base
Type of the data in the container.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Real psi_raw(Real x)
Compute the psi function.
Real findZero(IFunction< Function > const &f, Real const &x0, Real const &x1, Real tol)
find the zero of a function.
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
double Real
STK fundamental type of Real values.
hidden::SliceVisitorSelector< Derived, hidden::MeanVisitor, Arrays::by_col_ >::type_result mean(Derived const &A)
If A is a row-vector or a column-vector then the function will return the usual mean value of the vec...
std::basic_ostream< Char > ostream
ostream for Char
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.
Structure encapsulating the parameters of a Joint Gamma model.
CPointX shape_
vector of the shape
ModelGamma_aj_bjParameters(ModelGamma_aj_bjParameters const ¶m)
copy constructor.
~ModelGamma_aj_bjParameters()
destructor
ModelGamma_aj_bjParameters()
default constructor
CPointX scale_
vector of the scale
CPointX meanLog_
vector of the mean log of the observations
CPointX mean_
vector of the mean of the observations
void resize(Range const &range)
resize the parameters only if the range is modified, otherwise, stay with the current values.
ModelGamma_aj_bjParameters(Range const &range)
default constructor
CPointX const & shape() const
CPointX variance_
vector of the variance of the observations
CPointX const & scale() const
vector of the mean log of the observations
ModelGamma_aj_bjParameters Parameters
Type of the parameters of the ModelGamma_aj_bj.
Traits< Data_ >::Type Type
Type of the data in the container.
WColVector_ WColVector
Type of the array storing the weights of the data.
DataBridge< Data_ > Data
Type of the container storing the data.
Policy trait class for (Stat) Model classes.