likelihood¶
- LinearModel.likelihood(data: DataFrame) ndarray
Computes the likelihood of observations
response_variablegiven a model'mean'and'variance'.Parameters¶
- data: pandas.DataFrame
Data to use for likelihood computation. It cannot be empty. It must contain columns
response_variable,'mean'and'variance'.
Returns¶
- numpy.ndarray
Array of computed likelihood. It has the same length of
data. Each element is a likelihood computation of each row ofdata.
Raises¶
- TypeError
If
datais not an instance ofpandas.DataFrame.- ValueError
If
datais an emptypandas.DataFrame,if
response_variableis not a column ofdata,if
'mean'is not a column ofdata,if
'variance'is not a column ofdata.
Notes¶
The likelihood is computed with the normal distribution probability density function:
\[L(y) = \frac{1}{\sqrt{2 \pi \sigma^2}} \exp{- \frac{\left(y - \mu \right)^2}{2 \sigma^2}}\]where \(\mu\) is the
'mean'column and \(\sigma^2\) is the'variance'column.