ADMB Documentation
11.5.3197
|
Files | |
file | qfc_est.cpp |
negative log likelihood functions with other functions useful for model estimation | |
file | qfc_sim.cpp |
functions useful for simulation model in admb | |
Functions | |
dvar_vector | boundp (const dvar_vector &x, const double fmin, const double fmax, const dvariable &fpen) |
overloading bounded functions for vector, ADMB has builtin boundp, but not for vector type | |
bool | doubleEqual (double nVal1, double nVal2, int nPrecision) |
determine if two double values are equal within some precision | |
dmatrix | findValFromFile (adstring filename, adstring varName, int numVals) |
find the number of values(numVals) for one specific variable(varName) from an admb output file | |
dvar_vector | invLogitProp (const dvar_vector &p) |
reverse function for LogitProp | |
df1b2vector | log_comb (const df1b2vector &n, const df1b2vector &x) |
overloading function for log_comb(n choose x) for randome effect, used in nllBinomial below, ADMB built in function log_comb() not for vector type in RE | |
dvar_vector | logitProp (const dvar_vector &a) |
constrain probability vector as 1 and I forgot who create this first, may give credit to Punt., let logit(p)=log(p/(1-p))=a, so p=exp(a)/(1+exp(a)) ~[0,1] | |
dvector | matrix2vector (const dmatrix &input, int byrow=1) |
convert the matrix as a vector eithter by row=1(default) or by column=0, | |
dvar_vector | matrix2vector (const dvar_matrix &input, int byrow=1) |
convert the matrix as a vector eithter by row=1(default) or by column=0, overloading function | |
df1b2vector | matrix2vector (const df1b2matrix &input, int byrow=1) |
convert the matrix as a vector eithter by row=1(default) or by column=0, overloading function | |
dvariable | mf_upper_bound2 (const dvariable &x, const double fmax, dvariable &fpen) |
constrain parameter with upper threshold, if return bigger than it, then with penalty ADMB have built in function mf_upper_bound(), which have more constrain on the values higher than the bounds with bigger penalty than this version | |
double | nllBeta (const double x, const double a, const double b) |
nll for beta for one sample | |
df1b2variable | nllBeta (const df1b2variable &x, const double a, const double b) |
nll for beta for one sample for random effect | |
dvariable | nllBeta (const dvar_vector &x, const double a, const double b) |
nll for beta for many samples | |
df1b2variable | nllBeta (const df1b2vector &x, const double a, const double b) |
nll for beta for many samples for random effect | |
double | nllBinomial (const double x, const double n, const double p) |
nll for binomial for one sample | |
df1b2variable | nllBinomial (const df1b2variable &x, const double n, const double p) |
nll for binomial for one sample for random effect | |
dvariable | nllBinomial (const dvar_vector &x, const dvector &n, const double p) |
nll for binomial for many samples | |
df1b2variable | nllBinomial (const dvector &x, const df1b2vector &n, const df1b2variable &p) |
nll for binomial for many samples for random effect | |
double | nllDirichlet (const dvector &p, const dvector &shape) |
nll for dirichlet for one sample | |
df1b2variable | nllDirichlet (const df1b2vector &p, const dvector &shape) |
nll for dirichlet for one sample for random effect | |
double | nllGamma (const double &x, const double a, const double b) |
nll for gamma for one sample Gamma(a,b) similar to log_gamma_density(r,mu) in admb, in which a=r, b=mu | |
df1b2variable | nllGamma (const df1b2variable &x, const double a, const double b) |
nll for gamma for one sample for random effect Gamma(a,b) similar to log_gamma_density(r,mu) in admb, in which a=r, b=mu | |
double | nllGamma (const dvector &x, const double a, const double b) |
nll for gamma for many samples | |
df1b2variable | nllGamma (const df1b2vector &x, const double a, const double b) |
nll for gamma for many samples for random effect | |
double | nllInverseGamma (const double x, const double a, const double b) |
nll for inverse gamma for one sample | |
df1b2variable | nllInverseGamma (const df1b2variable &x, const double a, const double b) |
nll for inverse gamma for one sample for random effect | |
dvariable | nllInverseGamma (const dvar_vector &x, const double a, const double b) |
nll for inverse gamma for many samples | |
df1b2variable | nllInverseGamma (const dvector &x, const df1b2variable &a, const df1b2variable &b) |
nll for inverse gamma for many samples for random effect | |
double | nllLognormal (const double x, const double mu, const double sigma) |
nll for lognormal for one sample | |
df1b2variable | nllLognormal (const df1b2variable &x, const double mu, const double sigma) |
nll for lognormal for one sample for random effect | |
dvariable | nllLognormal (const dvar_vector &x, const double mu, const double sigma) |
nll for lognormal for many samples | |
df1b2variable | nllLognormal (const df1b2vector &x, const double mu, const double sigma) |
nll for lognormal for many samples for random effect | |
dvariable | nllLognormal (const dvar_vector &x, const dvector &mu, const double sigma) |
nll for lognormal for many samples, each has its mean | |
df1b2variable | nllLognormal (const df1b2vector &x, const dvector &mu, const double sigma) |
nll for lognormal for many samples, each has its mean, for random effect | |
dvariable | nllLognormal2 (const double x, const dvariable &mu, const dvariable &tau) |
nll for lognormal(mu,tau) for one sample | |
df1b2variable | nllLognormal2 (const df1b2variable x, const double mu, const double tau) |
nll for lognormal(mu,tau) for one sample for random effect | |
dvariable | nllLognormal2 (const dvar_vector &x, const double mu, const double tau) |
nll for lognormal(mu,tau) for many samples | |
df1b2variable | nllLognormal2 (const dvector &x, const df1b2variable &mu, const df1b2variable &tau) |
nll for lognormal(mu,tau) for many samples for random effect | |
dvariable | nllLognormal2 (const dvar_vector &x, const dvector &mu, const double tau) |
nll for lognormal(mu,tau) for many samples, each has its mean | |
df1b2variable | nllLognormal2 (const df1b2vector &x, const dvector &mu, const double tau) |
nll for lognormal(mu,tau) for many samples, each has its mean, overload for random effect, | |
double | nllMultiNomial (const dvector &obsN, const dvector &p) |
nll for Multinomial for one sample | |
df1b2variable | nllMultiNomial (const df1b2vector &obsN, const dvector &p) |
nll for Multinomial for one sample for random effect | |
double | nllNegativeBinomial (const double obs, const double m, const double s) |
nll for negative binomial N(m,s) for one sample, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
df1b2variable | nllNegativeBinomial (const df1b2variable &obs, const double m, const double s) |
nll for negative binomial N(m,s) for one sample,overload for random effect, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
dvariable | nllNegativeBinomial (const dvector &obs, const dvariable &m, const dvariable &s) |
nll for negative binomial N(m,s) for many samples, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
df1b2variable | nllNegativeBinomial (const df1b2vector &obs, const double m, const double s) |
nll for negative binomial N(m,s) for many samples, overload for random effect, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
double | nllNegativeBinomial2 (const double obs, const double m, const double tau) |
nll for negative binomial N(mu,tau) for one sample, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
df1b2variable | nllNegativeBinomial2 (const df1b2variable &obs, const double m, const double tau) |
nll for negative binomial N(mu,tau) for one sample,overload for random effect admb built in log_negbinomial_density(obs,mu,tau), in which tau=1. | |
double | nllNormal (const double x, const double mu, const double sigma) |
nll for normal for one sample | |
df1b2variable | nllNormal (const df1b2variable &x, const double mu, const double sigma) |
nll for normal for one sample for random effect | |
double | nllNormal (const dvector &x, const double mu, const double sigma) |
nll for normal for many samples, but mu is for common | |
df1b2variable | nllNormal (const df1b2vector &x, const double mu, const double sigma) |
nll for normal for many samples, but mu is for common, overload for random effect | |
dvariable | nllNormal (const dvar_vector &x, const dvector &mu, const double sigma) |
nll for normal for many samples, each has its own mean | |
df1b2variable | nllNormal (const df1b2vector &x, const dvector &mu, const double sigma) |
nll for normal for many samples, each has its own mean for random effect | |
dvariable | nllNormal2 (const dvariable &x, const double mu, const double tau) |
nll for normal(mu,tau) for one sample | |
df1b2variable | nllNormal2 (const df1b2variable &x, const double mu, const double tau) |
nll for normal(mu,tau) for one sample for random effect | |
dvariable | nllNormal2 (const dvar_vector &x, const double mu, const double tau) |
nll for normal(mu,tau) for many samples | |
df1b2variable | nllNormal2 (const df1b2vector &x, const double mu, const double tau) |
nll for normal(mu,tau) for many samples for random effect | |
dvariable | nllNormal2 (const dvar_vector &x, const dvector &mu, const double tau) |
nll for normal(mu,tau) for many samples, each has its own mean | |
df1b2variable | nllNormal2 (const df1b2vector &x, const dvector &mu, const double tau) |
nll for normal(mu,tau) for many samples, each has its own mean, overload for random effect, | |
double | nllPoisson (const double x, const double lambda) |
nll for poisson for one sample | |
df1b2variable | nllPoisson (const df1b2variable &x, const double lambda) |
nll for poisson for one sample for random effect | |
dvariable | nllPoisson (const dvar_vector &x, const double lambda) |
nll for poisson for many samples | |
df1b2variable | nllPoisson (const dvector &x, const df1b2variable &lambda) |
nll for poisson for many samples for random effect | |
dvar_vector | normalize_p (dvar_vector &p, dvariable fpen) |
normailize p as sum(p)=1, return p and penalty if sum(p)!=1 | |
int | numRows4VarFromFile (adstring filename, adstring varName) |
get how many rows for one specific variable(varName) in admb output file(filename) | |
dvar_vector | posfun (dvar_vector &x, const dvector &eps, dvariable &pen) |
overloading functions for posfun for vector and matrix, not sure if admb already do this in latest version | |
dvar_matrix | posfun (dvar_matrix &x, const dmatrix &eps, dvariable &pen) |
overloading functions for posfun for vector and matrix, not sure if admb already do this in latest version overloading function for matrix | |
double | rbeta (double alpha, double beta, random_number_generator &rng) |
generate random beta(alpha, beta) number, | |
dvector | rdirichlet (const dvector &shape, random_number_generator &rng) |
generate random dirichlet number | |
double | rgamma (double alpha, random_number_generator &rng) |
generate random gamma number, pseudo code see http://en.wikipedia.org/wiki/Gamma_distribution , Gamma(alpha, belta)=x^(alpha-1)*belta^alpha*exp(-belta*x)/gamma(alpha) | |
double | rgamma (double alpha, double beta, random_number_generator &rng) |
generate random gamma number, mean is alpha/belta, variance is alpha/(belta^2) | |
double | rlnorm (double mu, double sigma, random_number_generator &rng) |
generate one random lognormal number LN(mu,sigma) | |
double | rnorm (double mu, double sigma, random_number_generator &rng) |
generate one random normal number N(mu,sigma) | |
double | runif (double low, double upper, random_number_generator &rng) |
generate one random uniform from (low,upper) | |
ivector | sample (const dvector &source, int nSample, int withReplace, const random_number_generator &rng) |
generate a random sample index(size is nSample) based on the input samples(source) with or without replacement | |
dvector | unique (const dvector &in) |
find the unique values from input vector and only return the unique (by remove the duplicate) values in ascending order | |
dmatrix | vector2matrix (dvector &input, int nrow, int ncol, int byrow=1) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0, | |
df1b2matrix | vector2matrix (df1b2vector &input, int nrow, int ncol, int byrow=1) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0, overloading function | |
dvar_matrix | vector2matrix (const dvar_vector &input, int nrow, int ncol, int byrow=1) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0, overloading function |
Contributed by Weihai Liu
dvar_vector boundp | ( | const dvar_vector & | x, |
const double | fmin, | ||
const double | fmax, | ||
const dvariable & | fpen | ||
) |
overloading bounded functions for vector, ADMB has builtin boundp, but not for vector type
x | : being constrained input value |
fmin | : lower bound value |
fmax | : upper bound value |
fpen | : hold extra penalty, need add to objective function value later |
Definition at line 243 of file qfc_est.cpp.
bool doubleEqual | ( | double | nVal1, |
double | nVal2, | ||
int | nPrecision | ||
) |
determine if two double values are equal within some precision
nVal1 | : double value used for comparison |
nVal2 | : another double value used for comparison |
nPrecision | : the number of decimals |
Definition at line 383 of file qfc_sim.cpp.
dmatrix findValFromFile | ( | adstring | filename, |
adstring | varName, | ||
int | numVals | ||
) |
find the number of values(numVals) for one specific variable(varName) from an admb output file
filename | : search for admb output file name |
varName | : variable name being searched for |
numVals | : number of values following that specific variable names for return |
Definition at line 74 of file qfc_sim.cpp.
dvar_vector invLogitProp | ( | const dvar_vector & | p | ) |
reverse function for LogitProp
p | : the prob. vector |
Definition at line 82 of file qfc_est.cpp.
df1b2vector log_comb | ( | const df1b2vector & | n, |
const df1b2vector & | x | ||
) |
overloading function for log_comb(n choose x) for randome effect, used in nllBinomial below, ADMB built in function log_comb() not for vector type in RE
n | : number of trials |
x | : number of selected trial |
Definition at line 271 of file qfc_est.cpp.
dvar_vector logitProp | ( | const dvar_vector & | a | ) |
constrain probability vector as 1 and I forgot who create this first, may give credit to Punt., let logit(p)=log(p/(1-p))=a, so p=exp(a)/(1+exp(a)) ~[0,1]
a | : defined as real number without bounds in parameter_section, one element less than return p |
Definition at line 51 of file qfc_est.cpp.
dvector matrix2vector | ( | const dmatrix & | input, |
int | byrow = 1 |
||
) |
convert the matrix as a vector eithter by row=1(default) or by column=0,
input | : the matrix being converted, can also be ragged matrix |
byrow | : default as by row, use 1, anynumber other than 1 as by column |
Definition at line 208 of file qfc_sim.cpp.
dvar_vector matrix2vector | ( | const dvar_matrix & | input, |
int | byrow = 1 |
||
) |
convert the matrix as a vector eithter by row=1(default) or by column=0, overloading function
input | : the matrix being converted, can also be ragged matrix |
byrow | : default as by row, use 1, anynumber other than 1 as by column |
Definition at line 232 of file qfc_sim.cpp.
df1b2vector matrix2vector | ( | const df1b2matrix & | input, |
int | byrow = 1 |
||
) |
convert the matrix as a vector eithter by row=1(default) or by column=0, overloading function
input | : the matrix being converted, can also be ragged matrix |
byrow | : default as by row, use 1, anynumber other than 1 as by column |
Definition at line 256 of file qfc_sim.cpp.
dvariable mf_upper_bound2 | ( | const dvariable & | x, |
const double | fmax, | ||
dvariable & | fpen | ||
) |
constrain parameter with upper threshold, if return bigger than it, then with penalty ADMB have built in function mf_upper_bound(), which have more constrain on the values higher than the bounds with bigger penalty than this version
x | : mean parameter |
fmax | : upper threshold or maximum value, be positive |
fpen | : penalty |
Definition at line 210 of file qfc_est.cpp.
double nllBeta | ( | const double | x, |
const double | a, | ||
const double | b | ||
) |
nll for beta for one sample
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 885 of file qfc_est.cpp.
df1b2variable nllBeta | ( | const df1b2variable & | x, |
const double | a, | ||
const double | b | ||
) |
nll for beta for one sample for random effect
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 940 of file qfc_est.cpp.
dvariable nllBeta | ( | const dvar_vector & | x, |
const double | a, | ||
const double | b | ||
) |
nll for beta for many samples
x | : data |
a | : alpha parameter |
b | : beta parameter |
Definition at line 981 of file qfc_est.cpp.
df1b2variable nllBeta | ( | const df1b2vector & | x, |
const double | a, | ||
const double | b | ||
) |
nll for beta for many samples for random effect
x | : data |
a | : alpha parameter |
b | : beta parameter |
Definition at line 1017 of file qfc_est.cpp.
double nllBinomial | ( | const double | x, |
const double | n, | ||
const double | p | ||
) |
nll for binomial for one sample
x | : data |
n | : number of trials |
p | : probability |
Definition at line 1513 of file qfc_est.cpp.
df1b2variable nllBinomial | ( | const df1b2variable & | x, |
const double | n, | ||
const double | p | ||
) |
nll for binomial for one sample for random effect
x | : data |
n | : number of trials |
p | : probability |
Definition at line 1552 of file qfc_est.cpp.
dvariable nllBinomial | ( | const dvar_vector & | x, |
const dvector & | n, | ||
const double | p | ||
) |
nll for binomial for many samples
x | : data |
n | : number of trials |
p | : probability |
Definition at line 1582 of file qfc_est.cpp.
df1b2variable nllBinomial | ( | const dvector & | x, |
const df1b2vector & | n, | ||
const df1b2variable & | p | ||
) |
nll for binomial for many samples for random effect
x | : data |
n | : number of trials |
p | : probability |
Definition at line 1615 of file qfc_est.cpp.
double nllDirichlet | ( | const dvector & | p, |
const dvector & | shape | ||
) |
nll for dirichlet for one sample
p | : observation proportion, sum as 1 |
shape | : alpha parameter, >0 |
Definition at line 633 of file qfc_est.cpp.
df1b2variable nllDirichlet | ( | const df1b2vector & | p, |
const dvector & | shape | ||
) |
nll for dirichlet for one sample for random effect
p | : observation proportion, sum as 1 |
shape | : alpha parameter, >0 |
Definition at line 671 of file qfc_est.cpp.
double nllGamma | ( | const double & | x, |
const double | a, | ||
const double | b | ||
) |
nll for gamma for one sample Gamma(a,b) similar to log_gamma_density(r,mu) in admb, in which a=r, b=mu
x | : data |
a | : alpha parameter,also call shape,>0 |
b | : beta parameter,also call rate,>0 |
Definition at line 708 of file qfc_est.cpp.
df1b2variable nllGamma | ( | const df1b2variable & | x, |
const double | a, | ||
const double | b | ||
) |
nll for gamma for one sample for random effect Gamma(a,b) similar to log_gamma_density(r,mu) in admb, in which a=r, b=mu
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 762 of file qfc_est.cpp.
nll for gamma for many samples
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 803 of file qfc_est.cpp.
df1b2variable nllGamma | ( | const df1b2vector & | x, |
const double | a, | ||
const double | b | ||
) |
nll for gamma for many samples for random effect
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 846 of file qfc_est.cpp.
double nllInverseGamma | ( | const double | x, |
const double | a, | ||
const double | b | ||
) |
nll for inverse gamma for one sample
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 2274 of file qfc_est.cpp.
df1b2variable nllInverseGamma | ( | const df1b2variable & | x, |
const double | a, | ||
const double | b | ||
) |
nll for inverse gamma for one sample for random effect
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 2313 of file qfc_est.cpp.
dvariable nllInverseGamma | ( | const dvar_vector & | x, |
const double | a, | ||
const double | b | ||
) |
nll for inverse gamma for many samples
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 2355 of file qfc_est.cpp.
df1b2variable nllInverseGamma | ( | const dvector & | x, |
const df1b2variable & | a, | ||
const df1b2variable & | b | ||
) |
nll for inverse gamma for many samples for random effect
x | : data |
a | : alpha parameter,>0 |
b | : beta parameter,>0 |
Definition at line 2391 of file qfc_est.cpp.
double nllLognormal | ( | const double | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for lognormal for one sample
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1655 of file qfc_est.cpp.
df1b2variable nllLognormal | ( | const df1b2variable & | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for lognormal for one sample for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1710 of file qfc_est.cpp.
dvariable nllLognormal | ( | const dvar_vector & | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for lognormal for many samples
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1752 of file qfc_est.cpp.
df1b2variable nllLognormal | ( | const df1b2vector & | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for lognormal for many samples for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1788 of file qfc_est.cpp.
dvariable nllLognormal | ( | const dvar_vector & | x, |
const dvector & | mu, | ||
const double | sigma | ||
) |
nll for lognormal for many samples, each has its mean
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1820 of file qfc_est.cpp.
df1b2variable nllLognormal | ( | const df1b2vector & | x, |
const dvector & | mu, | ||
const double | sigma | ||
) |
nll for lognormal for many samples, each has its mean, for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1856 of file qfc_est.cpp.
dvariable nllLognormal2 | ( | const double | x, |
const dvariable & | mu, | ||
const dvariable & | tau | ||
) |
nll for lognormal(mu,tau) for one sample
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 1897 of file qfc_est.cpp.
df1b2variable nllLognormal2 | ( | const df1b2variable | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for lognormal(mu,tau) for one sample for random effect
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 1930 of file qfc_est.cpp.
dvariable nllLognormal2 | ( | const dvar_vector & | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for lognormal(mu,tau) for many samples
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 1972 of file qfc_est.cpp.
df1b2variable nllLognormal2 | ( | const dvector & | x, |
const df1b2variable & | mu, | ||
const df1b2variable & | tau | ||
) |
nll for lognormal(mu,tau) for many samples for random effect
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 2008 of file qfc_est.cpp.
dvariable nllLognormal2 | ( | const dvar_vector & | x, |
const dvector & | mu, | ||
const double | tau | ||
) |
nll for lognormal(mu,tau) for many samples, each has its mean
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 2055 of file qfc_est.cpp.
df1b2variable nllLognormal2 | ( | const df1b2vector & | x, |
const dvector & | mu, | ||
const double | tau | ||
) |
nll for lognormal(mu,tau) for many samples, each has its mean, overload for random effect,
x | : data |
mu | : mean parameter |
tau | : precision parameter, 1/variance |
Definition at line 2091 of file qfc_est.cpp.
double nllMultiNomial | ( | const dvector & | obsN, |
const dvector & | p | ||
) |
nll for Multinomial for one sample
obsN | : observation data |
p | : proportion vector, sum as 1 |
Definition at line 560 of file qfc_est.cpp.
df1b2variable nllMultiNomial | ( | const df1b2vector & | obsN, |
const dvector & | p | ||
) |
nll for Multinomial for one sample for random effect
obsN | : observation data |
p | : proportion vector, sum as 1 |
Definition at line 598 of file qfc_est.cpp.
double nllNegativeBinomial | ( | const double | obs, |
const double | m, | ||
const double | s | ||
) |
nll for negative binomial N(m,s) for one sample, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug use NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data x |
m | : mean |
s | : scaling factor, some use r NB(p,r) |
Definition at line 315 of file qfc_est.cpp.
Referenced by nllNegativeBinomial2().
df1b2variable nllNegativeBinomial | ( | const df1b2variable & | obs, |
const double | m, | ||
const double | s | ||
) |
nll for negative binomial N(m,s) for one sample,overload for random effect, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug use NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data x |
m | : mean |
s | : scaling factor, some use r NB(p,r) |
Definition at line 372 of file qfc_est.cpp.
dvariable nllNegativeBinomial | ( | const dvector & | obs, |
const dvariable & | m, | ||
const dvariable & | s | ||
) |
nll for negative binomial N(m,s) for many samples, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug use NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data |
m | : mean |
s | : scaling factor |
Definition at line 417 of file qfc_est.cpp.
df1b2variable nllNegativeBinomial | ( | const df1b2vector & | obs, |
const double | m, | ||
const double | s | ||
) |
nll for negative binomial N(m,s) for many samples, overload for random effect, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug use NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data |
m | : mean |
s | : scaling factor |
Definition at line 455 of file qfc_est.cpp.
double nllNegativeBinomial2 | ( | const double | obs, |
const double | m, | ||
const double | tau | ||
) |
nll for negative binomial N(mu,tau) for one sample, admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug us NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data |
m | : mean |
tau | : overdispersion parameter, |
Definition at line 495 of file qfc_est.cpp.
df1b2variable nllNegativeBinomial2 | ( | const df1b2variable & | obs, |
const double | m, | ||
const double | tau | ||
) |
nll for negative binomial N(mu,tau) for one sample,overload for random effect admb built in log_negbinomial_density(obs,mu,tau), in which tau=1.
+mu/s for NB(m,s), winbug us NB(p,r), in which p=s/(m+s) and r=s,
obs | : observation data |
m | : mean |
tau | : overdispersion parameter, |
Definition at line 529 of file qfc_est.cpp.
double nllNormal | ( | const double | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for normal for one sample
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1056 of file qfc_est.cpp.
df1b2variable nllNormal | ( | const df1b2variable & | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for normal for one sample for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1111 of file qfc_est.cpp.
nll for normal for many samples, but mu is for common
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1152 of file qfc_est.cpp.
df1b2variable nllNormal | ( | const df1b2vector & | x, |
const double | mu, | ||
const double | sigma | ||
) |
nll for normal for many samples, but mu is for common, overload for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1195 of file qfc_est.cpp.
dvariable nllNormal | ( | const dvar_vector & | x, |
const dvector & | mu, | ||
const double | sigma | ||
) |
nll for normal for many samples, each has its own mean
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1227 of file qfc_est.cpp.
df1b2variable nllNormal | ( | const df1b2vector & | x, |
const dvector & | mu, | ||
const double | sigma | ||
) |
nll for normal for many samples, each has its own mean for random effect
x | : data |
mu | : mean parameter |
sigma | : std deviation parameter |
Definition at line 1263 of file qfc_est.cpp.
dvariable nllNormal2 | ( | const dvariable & | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for one sample
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1304 of file qfc_est.cpp.
df1b2variable nllNormal2 | ( | const df1b2variable & | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for one sample for random effect
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1337 of file qfc_est.cpp.
dvariable nllNormal2 | ( | const dvar_vector & | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for many samples
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1367 of file qfc_est.cpp.
df1b2variable nllNormal2 | ( | const df1b2vector & | x, |
const double | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for many samples for random effect
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1403 of file qfc_est.cpp.
dvariable nllNormal2 | ( | const dvar_vector & | x, |
const dvector & | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for many samples, each has its own mean
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1435 of file qfc_est.cpp.
df1b2variable nllNormal2 | ( | const df1b2vector & | x, |
const dvector & | mu, | ||
const double | tau | ||
) |
nll for normal(mu,tau) for many samples, each has its own mean, overload for random effect,
x | : data |
mu | : mean parameter |
tau | : precision, 1/variance |
Definition at line 1471 of file qfc_est.cpp.
double nllPoisson | ( | const double | x, |
const double | lambda | ||
) |
nll for poisson for one sample
x | : data |
lambda | : mean parameter |
Definition at line 2132 of file qfc_est.cpp.
df1b2variable nllPoisson | ( | const df1b2variable & | x, |
const double | lambda | ||
) |
nll for poisson for one sample for random effect
x | : data |
lambda | : mean parameter |
Definition at line 2170 of file qfc_est.cpp.
dvariable nllPoisson | ( | const dvar_vector & | x, |
const double | lambda | ||
) |
nll for poisson for many samples
x | : data |
lambda | : mean parameter |
Definition at line 2198 of file qfc_est.cpp.
df1b2variable nllPoisson | ( | const dvector & | x, |
const df1b2variable & | lambda | ||
) |
nll for poisson for many samples for random effect
x | : data |
lambda | : mean parameter |
Definition at line 2233 of file qfc_est.cpp.
dvar_vector normalize_p | ( | dvar_vector & | p, |
dvariable | fpen | ||
) |
normailize p as sum(p)=1, return p and penalty if sum(p)!=1
p | : the prob. vector |
fpen | : penalty |
Definition at line 115 of file qfc_est.cpp.
int numRows4VarFromFile | ( | adstring | filename, |
adstring | varName | ||
) |
get how many rows for one specific variable(varName) in admb output file(filename)
filename | : search for admb output file name |
varName | : variable name being searched for |
Definition at line 40 of file qfc_sim.cpp.
Referenced by findValFromFile().
dvar_vector posfun | ( | dvar_vector & | x, |
const dvector & | eps, | ||
dvariable & | pen | ||
) |
overloading functions for posfun for vector and matrix, not sure if admb already do this in latest version
x | : being constrained input value |
eps | : positive vector as lower thresholds |
pen | : hold extra penalty, need add to objective function value later |
Definition at line 142 of file qfc_est.cpp.
dvar_matrix posfun | ( | dvar_matrix & | x, |
const dmatrix & | eps, | ||
dvariable & | pen | ||
) |
overloading functions for posfun for vector and matrix, not sure if admb already do this in latest version
overloading function for matrix
x | : being constrained input value |
eps | : positive vector as lower thresholds |
pen | : hold extra penalty, need add to objective function value later |
Definition at line 172 of file qfc_est.cpp.
double rbeta | ( | double | alpha, |
double | beta, | ||
random_number_generator & | rng | ||
) |
generate random beta(alpha, beta) number,
alpha | : alpha parameter |
beta | : beta parameter |
rng | : admb build in random number generator |
Definition at line 511 of file qfc_sim.cpp.
dvector rdirichlet | ( | const dvector & | shape, |
random_number_generator & | rng | ||
) |
generate random dirichlet number
shape | : shape parameter |
rng | : admb build in random number generator |
Definition at line 524 of file qfc_sim.cpp.
double rgamma | ( | double | alpha, |
random_number_generator & | rng | ||
) |
generate random gamma number, pseudo code see http://en.wikipedia.org/wiki/Gamma_distribution , Gamma(alpha, belta)=x^(alpha-1)*belta^alpha*exp(-belta*x)/gamma(alpha)
alpha | : shape parameter, >0 =1/CV^2 |
rng | : admb build in random number generator |
Definition at line 449 of file qfc_sim.cpp.
Referenced by rbeta(), rdirichlet(), and rgamma().
double rgamma | ( | double | alpha, |
double | beta, | ||
random_number_generator & | rng | ||
) |
generate random gamma number, mean is alpha/belta, variance is alpha/(belta^2)
alpha | : shape parameter, >0 =1/CV^2 |
beta | : rate =1/scale,inverse of the scale parameter, >0 =1/(mean*CV^2) |
rng | : admb build in random number generator |
Definition at line 497 of file qfc_sim.cpp.
double rlnorm | ( | double | mu, |
double | sigma, | ||
random_number_generator & | rng | ||
) |
generate one random lognormal number LN(mu,sigma)
mu | : mean |
sigma | : std. deviation |
rng | : admb build in random number generator |
Definition at line 433 of file qfc_sim.cpp.
double rnorm | ( | double | mu, |
double | sigma, | ||
random_number_generator & | rng | ||
) |
generate one random normal number N(mu,sigma)
mu | : mean |
sigma | : std. deviation |
rng | : admb build in random number generator |
Definition at line 418 of file qfc_sim.cpp.
double runif | ( | double | low, |
double | upper, | ||
random_number_generator & | rng | ||
) |
generate one random uniform from (low,upper)
low | : low range |
upper | : high range |
rng | : admb build in random number generator |
Definition at line 403 of file qfc_sim.cpp.
ivector sample | ( | const dvector & | source, |
int | nSample, | ||
int | withReplace, | ||
const random_number_generator & | rng | ||
) |
generate a random sample index(size is nSample) based on the input samples(source) with or without replacement
source | : baseline samples as input |
nSample | : random sample size for output |
withReplace | : if 0 for without replacement, nonzero means with replacement |
rng | : admb build in random number generator |
Definition at line 171 of file qfc_sim.cpp.
find the unique values from input vector and only return the unique (by remove the duplicate) values in ascending order
in | : contain duplicate values in the input vector |
Definition at line 127 of file qfc_sim.cpp.
dmatrix vector2matrix | ( | dvector & | input, |
int | nrow, | ||
int | ncol, | ||
int | byrow = 1 |
||
) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0,
input | : long vector/array being converted |
nrow | : the number of rows for output matrix |
ncol | : the number of columns for output matrix |
byrow | : default as by row, use 1, which fill the each row from top to bottom Or any number other than 1 as by column, which fill each column from left to right |
Definition at line 286 of file qfc_sim.cpp.
df1b2matrix vector2matrix | ( | df1b2vector & | input, |
int | nrow, | ||
int | ncol, | ||
int | byrow = 1 |
||
) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0, overloading function
input | : long vector/array being converted |
nrow | : the number of rows for output matrix |
ncol | : the number of columns for output matrix |
byrow | : default as by row, use 1, which fill the each row from top to bottom Or any number other than 1 as by column, which fill each column from left to right |
Definition at line 317 of file qfc_sim.cpp.
dvar_matrix vector2matrix | ( | const dvar_vector & | input, |
int | nrow, | ||
int | ncol, | ||
int | byrow = 1 |
||
) |
convert the Vector as a Matrix eithter by row=1(default) or by column=0, overloading function
input | : long vector/array being converted |
nrow | : the number of rows for output matrix |
ncol | : the number of columns for output matrix |
byrow | : default as by row, use 1, which fill the each row from top to bottom Or any number other than 1 as by column, which fill each column from left to right |
Definition at line 348 of file qfc_sim.cpp.
Generated on Tue Mar 8 2016 19:51:38 for ADMB Documentation by 1.8.0 |