ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
dnorm.cpp File Reference

(Last Changed on August 10, 2014 for git-revision 32e21a2a69845383ec666716b187f2ca1d0c5bf7.)

Normal density functions. More...

#include "statsLib.h"
#include <admodel.h>
#include <df1b2fun.h>
#include <adrndeff.h>

Go to the source code of this file.

Functions

dvariable dnorm (const prevariable &x, const double &mu, const double &std)
 
dvariable dnorm (const prevariable &x, const double &mu, const double &std, bool bLog=true)
 
df1b2variable dnorm (const df1b2variable &x, const df1b2variable &mu, const df1b2variable &std, bool bLog=true)
 
df1b2variable dnorm (const df1b2variable &x, const double &mu, const double &std)
 
df1b2variable dnorm (const df1b2variable &x, const double &mu, const double &std, bool bLog=true)
 
dvariable dnorm (const dvar_vector &x, const double &mu, const double &std)
 
dvariable dnorm (const dvar_vector &x, const double &mu, const double &std, bool bLog=true)
 
df1b2variable dnorm (const df1b2vector &x, const double &mu, const double &std, bool bLog=true)
 
dvariable dnorm (const dvector &x, const prevariable &mu, const prevariable &std)
 
dvariable dnorm (const dvar_vector &residual, const prevariable &std)
 
dvariable dnorm (const dvar_vector &residual, const double &std)
 
dvariable dnorm (const dvar_vector &residual, const dvector &std)
 
dvariable dnorm (const dvar_vector &residual)
 
dvariable dnorm (const dmatrix &obs, const dvar_matrix &pred)
 
dvariable dnorm (const dvar_vector &residual, const dvar_vector std)
 

Detailed Description

Normal density functions.

Author
Steven Martell
Date
2/05/2011

This file contains the negative loglikelihood functions for the normal distribution and is implemented to be consistent with the statistical program R with log=TRUE. The function dnorm is overloaded to accomodate single variables and vectors.

There are also overloaded versions where the user can specify the likelihood (i.e., log=FALSE)

The function is implemented as the negative log of the normal density function:

\[ 0.5\ln(2 \pi) + \ln(\sigma) + 0.5\frac{(x-\mu)^2}{\sigma^2} \]

where $\mu$ is the mean and $\sigma$ is the standard deviation.

The concentrated likelihood is implemented as:

\[ 0.5 n \ln(\sum_{i=1}^{n}\epsilon^2) \]

where $ \epsilon $ is a vector of residuals with an assumed mean 0.

Definition in file dnorm.cpp.

Function Documentation

dvariable dnorm ( const prevariable x,
const double &  mu,
const double &  std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
xa differentiable variable
muthe mean
stda double precision standard deviation
Returns
returns the negative loglikelihood of the normal distribution
See Also

Definition at line 46 of file dnorm.cpp.

dvariable dnorm ( const prevariable x,
const double &  mu,
const double &  std,
bool  bLog = true 
)

Definition at line 59 of file dnorm.cpp.

df1b2variable dnorm ( const df1b2variable x,
const df1b2variable mu,
const df1b2variable std,
bool  bLog = true 
)

Definition at line 75 of file dnorm.cpp.

df1b2variable dnorm ( const df1b2variable x,
const double &  mu,
const double &  std 
)

Definition at line 90 of file dnorm.cpp.

df1b2variable dnorm ( const df1b2variable x,
const double &  mu,
const double &  std,
bool  bLog = true 
)

Definition at line 105 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector x,
const double &  mu,
const double &  std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
xvariable vector of observations
mua double mean
stda double standard deviation
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 130 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector x,
const double &  mu,
const double &  std,
bool  bLog = true 
)

Definition at line 148 of file dnorm.cpp.

df1b2variable dnorm ( const df1b2vector x,
const double &  mu,
const double &  std,
bool  bLog = true 
)

Definition at line 167 of file dnorm.cpp.

dvariable dnorm ( const dvector x,
const prevariable mu,
const prevariable std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
xa vector of observations
mua variable mean
stda variable standard deviation
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 195 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector residual,
const prevariable std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
residuala variable vector of residuals
stda variable standard deviation
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 259 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector residual,
const double &  std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
residuala variable vector of residuals
stda double standard deviation
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 285 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector residual,
const dvector std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
residuala variable vector of residuals
stda vector of standard deviations
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 311 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector residual)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
residuala variable vector of residuals
Returns
returns the concentrated likelihood for the normal distribution.
See Also

Definition at line 345 of file dnorm.cpp.

dvariable dnorm ( const dmatrix obs,
const dvar_matrix pred 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
obsa matrix of observed values
preda variable matrix of predicted values
Returns
returns the concentrated likelihood for the normal distribution.
See Also

Definition at line 363 of file dnorm.cpp.

dvariable dnorm ( const dvar_vector residual,
const dvar_vector  std 
)
Author
Steven James Dean Martell
Date
2011-06-21
Parameters
residuala variable vector of residuals
stda variable vector of standard deviations
Returns
returns the sum of negative loglikelihoods of the normal distribution
See Also

Definition at line 382 of file dnorm.cpp.