ADMB Documentation
-a65f1c97
|
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 More... | |
bool | doubleEqual (double nVal1, double nVal2, int nPrecision) |
determine if two double values are equal within some precision More... | |
dmatrix | findValFromFile (adstring filename, adstring varName, int numVals) |
find the number of values(numVals) for one specific variable(varName) from an admb output file More... | |
dvar_vector | invLogitProp (const dvar_vector &p) |
reverse function for LogitProp More... | |
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 More... | |
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] More... | |
dvector | matrix2vector (const dmatrix &input, int byrow=1) |
convert the matrix as a vector eithter by row=1(default) or by column=0, More... | |
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 More... | |
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 More... | |
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 More... | |
double | nllBeta (const double x, const double a, const double b) |
nll for beta for one sample More... | |
df1b2variable | nllBeta (const df1b2variable &x, const double a, const double b) |
nll for beta for one sample for random effect More... | |
dvariable | nllBeta (const dvar_vector &x, const double a, const double b) |
nll for beta for many samples More... | |
df1b2variable | nllBeta (const df1b2vector &x, const double a, const double b) |
nll for beta for many samples for random effect More... | |
double | nllBinomial (const double x, const double n, const double p) |
nll for binomial for one sample More... | |
df1b2variable | nllBinomial (const df1b2variable &x, const double n, const double p) |
nll for binomial for one sample for random effect More... | |
dvariable | nllBinomial (const dvar_vector &x, const dvector &n, const double p) |
nll for binomial for many samples More... | |
df1b2variable | nllBinomial (const dvector &x, const df1b2vector &n, const df1b2variable &p) |
nll for binomial for many samples for random effect More... | |
double | nllDirichlet (const dvector &p, const dvector &shape) |
nll for dirichlet for one sample More... | |
df1b2variable | nllDirichlet (const df1b2vector &p, const dvector &shape) |
nll for dirichlet for one sample for random effect More... | |
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 More... | |
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 More... | |
double | nllGamma (const dvector &x, const double a, const double b) |
nll for gamma for many samples More... | |
df1b2variable | nllGamma (const df1b2vector &x, const double a, const double b) |
nll for gamma for many samples for random effect More... | |
double | nllInverseGamma (const double x, const double a, const double b) |
nll for inverse gamma for one sample More... | |
df1b2variable | nllInverseGamma (const df1b2variable &x, const double a, const double b) |
nll for inverse gamma for one sample for random effect More... | |
dvariable | nllInverseGamma (const dvar_vector &x, const double a, const double b) |
nll for inverse gamma for many samples More... | |
df1b2variable | nllInverseGamma (const dvector &x, const df1b2variable &a, const df1b2variable &b) |
nll for inverse gamma for many samples for random effect More... | |
double | nllLognormal (const double x, const double mu, const double sigma) |
nll for lognormal for one sample More... | |
df1b2variable | nllLognormal (const df1b2variable &x, const double mu, const double sigma) |
nll for lognormal for one sample for random effect More... | |
dvariable | nllLognormal (const dvar_vector &x, const double mu, const double sigma) |
nll for lognormal for many samples More... | |
df1b2variable | nllLognormal (const df1b2vector &x, const double mu, const double sigma) |
nll for lognormal for many samples for random effect More... | |
dvariable | nllLognormal (const dvar_vector &x, const dvector &mu, const double sigma) |
nll for lognormal for many samples, each has its mean More... | |
df1b2variable | nllLognormal (const df1b2vector &x, const dvector &mu, const double sigma) |
nll for lognormal for many samples, each has its mean, for random effect More... | |
dvariable | nllLognormal2 (const double x, const dvariable &mu, const dvariable &tau) |
nll for lognormal(mu,tau) for one sample More... | |
df1b2variable | nllLognormal2 (const df1b2variable x, const double mu, const double tau) |
nll for lognormal(mu,tau) for one sample for random effect More... | |
dvariable | nllLognormal2 (const dvar_vector &x, const double mu, const double tau) |
nll for lognormal(mu,tau) for many samples More... | |
df1b2variable | nllLognormal2 (const dvector &x, const df1b2variable &mu, const df1b2variable &tau) |
nll for lognormal(mu,tau) for many samples for random effect More... | |
dvariable | nllLognormal2 (const dvar_vector &x, const dvector &mu, const double tau) |
nll for lognormal(mu,tau) for many samples, each has its mean More... | |
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, More... | |
double | nllMultiNomial (const dvector &obsN, const dvector &p) |
nll for Multinomial for one sample More... | |
df1b2variable | nllMultiNomial (const df1b2vector &obsN, const dvector &p) |
nll for Multinomial for one sample for random effect More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
double | nllNormal (const double x, const double mu, const double sigma) |
nll for normal for one sample More... | |
df1b2variable | nllNormal (const df1b2variable &x, const double mu, const double sigma) |
nll for normal for one sample for random effect More... | |
double | nllNormal (const dvector &x, const double mu, const double sigma) |
nll for normal for many samples, but mu is for common More... | |
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 More... | |
dvariable | nllNormal (const dvar_vector &x, const dvector &mu, const double sigma) |
nll for normal for many samples, each has its own mean More... | |
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 More... | |
dvariable | nllNormal2 (const dvariable &x, const double mu, const double tau) |
nll for normal(mu,tau) for one sample More... | |
df1b2variable | nllNormal2 (const df1b2variable &x, const double mu, const double tau) |
nll for normal(mu,tau) for one sample for random effect More... | |
dvariable | nllNormal2 (const dvar_vector &x, const double mu, const double tau) |
nll for normal(mu,tau) for many samples More... | |
df1b2variable | nllNormal2 (const df1b2vector &x, const double mu, const double tau) |
nll for normal(mu,tau) for many samples for random effect More... | |
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 More... | |
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, More... | |
double | nllPoisson (const double x, const double lambda) |
nll for poisson for one sample More... | |
df1b2variable | nllPoisson (const df1b2variable &x, const double lambda) |
nll for poisson for one sample for random effect More... | |
dvariable | nllPoisson (const dvar_vector &x, const double lambda) |
nll for poisson for many samples More... | |
df1b2variable | nllPoisson (const dvector &x, const df1b2variable &lambda) |
nll for poisson for many samples for random effect More... | |
dvar_vector | normalize_p (dvar_vector &p, dvariable fpen) |
normailize p as sum(p)=1, return p and penalty if sum(p)!=1 More... | |
int | numRows4VarFromFile (adstring filename, adstring varName) |
get how many rows for one specific variable(varName) in admb output file(filename) More... | |
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 More... | |
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 More... | |
double | rbeta (double alpha, double beta, random_number_generator &rng) |
generate random beta(alpha, beta) number, More... | |
dvector | rdirichlet (const dvector &shape, random_number_generator &rng) |
generate random dirichlet number More... | |
double | qfclib::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) More... | |
double | rgamma (double alpha, double beta, random_number_generator &rng) |
generate random gamma number, mean is alpha/belta, variance is alpha/(belta^2) More... | |
double | rlnorm (double mu, double sigma, random_number_generator &rng) |
generate one random lognormal number LN(mu,sigma) More... | |
double | rnorm (double mu, double sigma, random_number_generator &rng) |
generate one random normal number N(mu,sigma) More... | |
double | runif (double low, double upper, random_number_generator &rng) |
generate one random uniform from (low,upper) More... | |
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 More... | |
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 More... | |
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, More... | |
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 More... | |
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 More... | |
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.
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.
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.
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.
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.
double nllGamma | ( | const dvector & | x, |
const double | a, | ||
const double | b | ||
) |
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.
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.
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.
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.
double nllNormal | ( | const dvector & | x, |
const double | mu, | ||
const double | sigma | ||
) |
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.
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.
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 508 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 521 of file qfc_sim.cpp.
double qfclib::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)
Copyright (c) 2016 ADMB Foundation.
alpha | : shape parameter, >0 =1/CV^2 |
rng | : admb build in random number generator |
Definition at line 447 of file qfc_sim.cpp.
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 494 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.
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 Wed Sep 7 2022 00:01:32 for ADMB Documentation by 1.8.5 |