ADMB Documentation  11.1.2342
 All Classes Files Functions Variables Typedefs Friends Defines
qfclib.h
Go to the documentation of this file.
00001 
00028 #ifndef _QFCLIB_H_
00029 #define _QFCLIB_H_
00030 
00031 #include <math.h>
00032 #include <admodel.h>
00033 #include <df1b2fun.h>
00034 #include <adrndeff.h>
00035 // define constant variable
00036 const double EPS = 1.e-20;   
00037 const double QFC_M_E= 1.e-20;   
00038 
00039 //function defined for simulation model
00040 int     numRows4VarFromFile (adstring filename, adstring varName);
00041 dmatrix   findValFromFile (adstring filename, adstring varName, int numVals);
00042 dvector   unique (const dvector &in);
00043 ivector   sample (const dvector &source, int nSample, int withReplace, const random_number_generator &rng);
00044 dvector   matrix2vector (const dmatrix &input, int byrow);
00045 dvar_vector   matrix2vector (const dvar_matrix &input, int byrow);
00046 df1b2vector   matrix2vector (const df1b2matrix &input, int byrow);
00047 dmatrix   vector2matrix (dvector &input, int nrow, int ncol, int byrow);
00048 df1b2matrix   vector2matrix (df1b2vector &input, int nrow, int ncol, int byrow);
00049 dvar_matrix   vector2matrix (const dvar_vector &input, int nrow, int ncol, int byrow);
00050 bool    doubleEqual (double nVal1, double nVal2, int nPrecision);
00051 double    runif (double low, double upper, random_number_generator &rng);
00052 double    rnorm (double mu, double sigma, random_number_generator &rng);
00053 double rlnorm(double mu, double sigma, random_number_generator & rng);
00054 double    rgamma (double alpha, random_number_generator &rng);
00055 double    rgamma (double alpha, double beta, random_number_generator &rng);
00056 double rbeta(double alpha, double beta, random_number_generator& rng);
00057 dvector   rdirichlet (const dvector &shape, random_number_generator &rng);
00058 
00059 //function defined for estimation model
00060 dvar_vector   logitProp (const dvar_vector &a);
00061 df1b2vector   logitProp (const df1b2vector &a);
00062 dvar_vector   invLogitProp (const dvar_vector &p);
00063 df1b2vector   invLogitProp (const df1b2vector &p);
00064 dvar_vector   normalize_p (dvar_vector &p, dvariable fpen);
00065 df1b2vector   normalize_p (df1b2vector &p, df1b2variable fpen);
00066 dvar_vector   posfun (dvar_vector &x, const dvector &eps, dvariable &pen);
00067 df1b2vector   posfun (df1b2vector &x, const dvector &eps, df1b2variable &pen);
00068 dvar_matrix   posfun (dvar_matrix &x, const dmatrix &eps, dvariable &pen);
00069 df1b2matrix   posfun (df1b2matrix &x, const dmatrix &eps, df1b2variable &pen);
00070 dvariable   mf_upper_bound2 (const dvariable &x, const double fmax, dvariable &fpen);
00071 df1b2variable   mf_upper_bound2 (const df1b2variable &x, const double fmax, df1b2variable &fpen);
00072 dvar_vector   boundp (const dvar_vector &x, const double fmin, const double fmax, const dvariable &fpen);
00073 df1b2vector   boundp (const df1b2vector &x, const double fmin, const double fmax, const df1b2variable &fpen);
00074 df1b2vector   log_comb (const df1b2vector &n, const df1b2vector &x);
00075 df1b2vector   log_comb (const df1b2vector &n, const dvector &x);
00076 df1b2vector   log_comb (const dvector &n, const df1b2vector &x);
00077 double  nllNegativeBinomial (const double obs, const double m, const double s);
00078 dvariable   nllNegativeBinomial (const dvariable &obs, const double m, const double s);
00079 dvariable   nllNegativeBinomial (const double obs, const dvariable &m, const dvariable &s);
00080 dvariable   nllNegativeBinomial (const dvariable &obs, const dvariable &m, const double s);
00081 dvariable   nllNegativeBinomial (const dvariable &obs, const double m, const dvariable &s);
00082 dvariable   nllNegativeBinomial (const dvariable &obs, const dvariable &m, const dvariable &s);
00083 df1b2variable   nllNegativeBinomial (const df1b2variable &obs, const double m, const double s);
00084 df1b2variable   nllNegativeBinomial (const double obs, const df1b2variable &m, const df1b2variable &s);
00085 df1b2variable   nllNegativeBinomial (const df1b2variable &obs, const df1b2variable &m, const double s);
00086 df1b2variable   nllNegativeBinomial (const df1b2variable &obs, const double m, const df1b2variable &s);
00087 df1b2variable   nllNegativeBinomial (const df1b2variable &obs, const df1b2variable &m, const df1b2variable &s);
00088 dvariable   nllNegativeBinomial (const dvector &obs, const dvariable &m, const dvariable &s);
00089 dvariable   nllNegativeBinomial (const dvar_vector &obs, const double m, const double s);
00090 dvariable   nllNegativeBinomial (const dvar_vector &obs, const dvariable &m, const dvariable &s);
00091 df1b2variable   nllNegativeBinomial (const df1b2vector &obs, const double m, const double s);
00092 df1b2variable   nllNegativeBinomial (const dvector &obs, const df1b2variable &m, const df1b2variable &s);
00093 df1b2variable   nllNegativeBinomial (const df1b2vector &obs, const df1b2variable &m, const df1b2variable &s);
00094 double  nllNegativeBinomial2 (const double obs, const double m, const double tau);
00095 dvariable   nllNegativeBinomial2 (const double obs, const dvariable &m, const dvariable &tau);
00096 dvariable   nllNegativeBinomial2 (const dvariable &obs, const double m, const double tau);
00097 dvariable   nllNegativeBinomial2 (const dvariable &obs, const dvariable &m, const double tau);
00098 dvariable   nllNegativeBinomial2 (const dvariable &obs, const double m, const dvariable &tau);
00099 dvariable   nllNegativeBinomial2 (const dvariable &obs, const dvariable &m, const dvariable &tau);
00100 df1b2variable   nllNegativeBinomial2 (const df1b2variable &obs, const double m, const double tau);
00101 df1b2variable   nllNegativeBinomial2 (const double obs, const df1b2variable &m, const df1b2variable &tau);
00102 df1b2variable   nllNegativeBinomial2 (const df1b2variable &obs, const df1b2variable &m, const df1b2variable &tau);
00103 double  nllMultiNomial (const dvector &obsN, const dvector &p);
00104 dvariable   nllMultiNomial (const dvector &obsN, const dvar_vector &p);
00105 dvariable   nllMultiNomial (const dvar_vector &obsN, const dvector &p);
00106 dvariable   nllMultiNomial (const dvar_vector &obsN, const dvar_vector &p);
00107 df1b2variable   nllMultiNomial (const df1b2vector &obsN, const dvector &p);
00108 df1b2variable   nllMultiNomial (const dvector &obsN, const df1b2vector &p);
00109 df1b2variable   nllMultiNomial (const df1b2vector &obsN, const df1b2vector &p);
00110 double  nllDirichlet (const dvector &p, const dvector &shape);
00111 dvariable   nllDirichlet (const dvar_vector &p, const dvector &shape);
00112 dvariable   nllDirichlet (const dvector &p, const dvar_vector &shape);
00113 dvariable   nllDirichlet (const dvar_vector &p, const dvar_vector &shape);
00114 df1b2variable   nllDirichlet (const df1b2vector &p, const dvector &shape);
00115 df1b2variable   nllDirichlet (const dvector &p, const df1b2vector &shape);
00116 df1b2variable   nllDirichlet (const df1b2vector &p, const df1b2vector &shape);
00117 double  nllGamma (const double &x, const double a, const double b);
00118 dvariable   nllGamma (const dvariable &x, const double a, const double b);
00119 dvariable   nllGamma (const double x, const dvariable &a, const dvariable &b);
00120 dvariable   nllGamma (const dvariable &x, const dvariable &a, const double b);
00121 dvariable   nllGamma (const dvariable &x, const double a, const dvariable &b);
00122 dvariable   nllGamma (const dvariable &x, const dvariable &a, const dvariable &b);
00123 df1b2variable   nllGamma (const df1b2variable &x, const double a, const double b);
00124 df1b2variable   nllGamma (const double x, const df1b2variable &a, const df1b2variable &b);
00125 df1b2variable   nllGamma (const df1b2variable &x, const df1b2variable &a, const double b);
00126 df1b2variable   nllGamma (const df1b2variable &x, const double a, const df1b2variable &b);
00127 df1b2variable   nllGamma (const df1b2variable &x, const df1b2variable &a, const df1b2variable &b);
00128 double  nllGamma (const dvector &x, const double a, const double b);
00129 dvariable   nllGamma (const dvar_vector &x, const double a, const double b);
00130 dvariable   nllGamma (const dvector &x, const dvariable &a, const dvariable &b);
00131 dvariable   nllGamma (const dvar_vector &x, const dvariable &a, const dvariable &b);
00132 df1b2variable   nllGamma (const df1b2vector &x, const double a, const double b);
00133 df1b2variable   nllGamma (const dvector &x, const df1b2variable &a, const df1b2variable &b);
00134 df1b2variable   nllGamma (const df1b2vector &x, const df1b2variable &a, const df1b2variable &b);
00135 double  nllBeta (const double x, const double a, const double b);
00136 dvariable   nllBeta (const dvariable &x, const double a, const double b);
00137 dvariable   nllBeta (const double x, const dvariable &a, const dvariable &b);
00138 dvariable   nllBeta (const dvariable &x, const dvariable &a, const double b);
00139 dvariable   nllBeta (const dvariable &x, const double a, const dvariable &b);
00140 dvariable   nllBeta (const dvariable &x, const dvariable &a, const dvariable &b);
00141 df1b2variable   nllBeta (const df1b2variable &x, const double a, const double b);
00142 df1b2variable   nllBeta (const df1b2variable &x, const df1b2variable &a, const double b);
00143 df1b2variable   nllBeta (const df1b2variable &x, const double a, const df1b2variable &b);
00144 df1b2variable   nllBeta (const double x, const df1b2variable &a, const df1b2variable &b);
00145 df1b2variable   nllBeta (const df1b2variable &x, const df1b2variable &a, const df1b2variable &b);
00146 dvariable   nllBeta (const dvar_vector &x, const double a, const double b);
00147 dvariable   nllBeta (const dvector &x, const dvariable &a, const dvariable &b);
00148 dvariable   nllBeta (const dvar_vector &x, const dvariable &a, const dvariable &b);
00149 df1b2variable   nllBeta (const df1b2vector &x, const double a, const double b);
00150 df1b2variable   nllBeta (const dvector &x, const df1b2variable &a, const df1b2variable &b);
00151 df1b2variable   nllBeta (const df1b2vector &x, const df1b2variable &a, const df1b2variable &b);
00152 double  nllNormal (const double x, const double mu, const double sigma);
00153 dvariable   nllNormal (const dvariable &x, const double mu, const double sigma);
00154 dvariable   nllNormal (const double x, const dvariable &mu, const dvariable &sigma);
00155 dvariable   nllNormal (const dvariable &x, const dvariable &mu, const double sigma);
00156 dvariable   nllNormal (const dvariable &x, const double mu, const dvariable &sigma);
00157 dvariable   nllNormal (const dvariable &x, const dvariable &mu, const dvariable &sigma);
00158 df1b2variable   nllNormal (const df1b2variable &x, const double mu, const double sigma);
00159 df1b2variable   nllNormal (const df1b2variable &x, const df1b2variable &mu, const double sigma);
00160 df1b2variable   nllNormal (const df1b2variable &x, const double mu, const df1b2variable &sigma);
00161 df1b2variable   nllNormal (const double x, const df1b2variable &mu, const df1b2variable &sigma);
00162 df1b2variable   nllNormal (const df1b2variable &x, const df1b2variable &mu, const df1b2variable &sigma);
00163 double  nllNormal (const dvector &x, const double mu, const double sigma);
00164 dvariable   nllNormal (const dvar_vector &x, const double mu, const double sigma);
00165 dvariable   nllNormal (const dvector &x, const dvariable &mu, const dvariable &sigma);
00166 dvariable   nllNormal (const dvar_vector &x, const dvariable &mu, const dvariable &sigma);
00167 df1b2variable   nllNormal (const df1b2vector &x, const double mu, const double sigma);
00168 df1b2variable   nllNormal (const dvector &x, const df1b2variable &mu, const df1b2variable &sigma);
00169 df1b2variable   nllNormal (const df1b2vector &x, const df1b2variable &mu, const df1b2variable &sigma);
00170 dvariable   nllNormal (const dvar_vector &x, const dvector &mu, const double sigma);
00171 dvariable   nllNormal (const dvector &x, const dvar_vector &mu, const dvariable &sigma);
00172 dvariable   nllNormal (const dvar_vector &x, const dvar_vector &mu, const dvariable &sigma);
00173 df1b2variable   nllNormal (const df1b2vector &x, const dvector &mu, const double sigma);
00174 df1b2variable   nllNormal (const dvector &x, const df1b2vector &mu, const df1b2variable &sigma);
00175 df1b2variable   nllNormal (const df1b2vector &x, const df1b2vector &mu, const df1b2variable &sigma);
00176 dvariable   nllNormal2 (const dvariable &x, const double mu, const double tau);
00177 dvariable   nllNormal2 (const double x, const dvariable &mu, const dvariable &tau);
00178 dvariable   nllNormal2 (const dvariable &x, const dvariable &mu, const dvariable &tau);
00179 df1b2variable   nllNormal2 (const df1b2variable &x, const double mu, const double tau);
00180 df1b2variable   nllNormal2 (const double x, const df1b2variable &mu, const df1b2variable &tau);
00181 df1b2variable   nllNormal2 (const df1b2variable &x, const df1b2variable &mu, const df1b2variable &tau);
00182 dvariable   nllNormal2 (const dvar_vector &x, const double mu, const double tau);
00183 dvariable   nllNormal2 (const dvector &x, const dvariable &mu, const dvariable &tau);
00184 dvariable   nllNormal2 (const dvar_vector &x, const dvariable &mu, const dvariable &tau);
00185 df1b2variable   nllNormal2 (const df1b2vector &x, const double mu, const double tau);
00186 df1b2variable   nllNormal2 (const dvector &x, const df1b2variable &mu, const df1b2variable &tau);
00187 df1b2variable   nllNormal2 (const df1b2vector &x, const df1b2variable &mu, const df1b2variable &tau);
00188 dvariable   nllNormal2 (const dvar_vector &x, const dvector &mu, const double tau);
00189 dvariable   nllNormal2 (const dvector &x, const dvar_vector &mu, const dvariable &tau);
00190 dvariable   nllNormal2 (const dvar_vector &x, const dvar_vector &mu, const dvariable &tau);
00191 df1b2variable   nllNormal2 (const df1b2vector &x, const dvector &mu, const double tau);
00192 df1b2variable   nllNormal2 (const dvector &x, const df1b2vector &mu, const df1b2variable &tau);
00193 df1b2variable   nllNormal2 (const df1b2vector &x, const df1b2vector &mu, const df1b2variable &tau);
00194 double  nllBinomial (const double x, const double n, const double p);
00195 dvariable   nllBinomial (const dvariable &x, const double n, const double p);
00196 dvariable   nllBinomial (const double x, const dvariable &n, const dvariable &p);
00197 dvariable   nllBinomial (const dvariable &x, const dvariable &n, const dvariable &p);
00198 df1b2variable   nllBinomial (const df1b2variable &x, const double n, const double p);
00199 df1b2variable   nllBinomial (const double x, const df1b2variable &n, const df1b2variable &p);
00200 df1b2variable   nllBinomial (const df1b2variable &x, const df1b2variable &n, const df1b2variable &p);
00201 dvariable   nllBinomial (const dvar_vector &x, const dvector &n, const double p);
00202 dvariable   nllBinomial (const dvector &x, const dvar_vector &n, const dvariable &p);
00203 dvariable   nllBinomial (const dvar_vector &x, const dvar_vector &n, const dvariable &p);
00204 df1b2variable   nllBinomial (const dvector &x, const df1b2vector &n, const df1b2variable &p);
00205 df1b2variable   nllBinomial (const df1b2vector &x, const dvector &n, const double p);
00206 df1b2variable   nllBinomial (const df1b2vector &x, const df1b2vector &n, const df1b2variable &p);
00207 double  nllLognormal (const double x, const double mu, const double sigma);
00208 dvariable   nllLognormal (const dvariable &x, const double mu, const double sigma);
00209 dvariable   nllLognormal (const double x, const dvariable &mu, const dvariable &sigma);
00210 dvariable   nllLognormal (const dvariable &x, const dvariable &mu, const double sigma);
00211 dvariable   nllLognormal (const dvariable &x, const double mu, const dvariable &sigma);
00212 dvariable   nllLognormal (const dvariable &x, const dvariable &mu, const dvariable &sigma);
00213 df1b2variable   nllLognormal (const df1b2variable &x, const double mu, const double sigma);
00214 df1b2variable   nllLognormal (const double x, const df1b2variable &mu, const df1b2variable &sigma);
00215 df1b2variable   nllLognormal (const df1b2variable &x, const df1b2variable &mu, const double sigma);
00216 df1b2variable   nllLognormal (const df1b2variable &x, const double mu, const df1b2variable &sigma);
00217 df1b2variable   nllLognormal (const df1b2variable &x, const df1b2variable &mu, const df1b2variable &sigma);
00218 dvariable   nllLognormal (const dvar_vector &x, const double mu, const double sigma);
00219 dvariable   nllLognormal (const dvector &x, const dvariable &mu, const dvariable &sigma);
00220 dvariable   nllLognormal (const dvar_vector &x, const dvariable &mu, const dvariable &sigma);
00221 df1b2variable   nllLognormal (const df1b2vector &x, const double mu, const double sigma);
00222 df1b2variable   nllLognormal (const dvector &x, const df1b2variable &mu, const df1b2variable &sigma);
00223 df1b2variable   nllLognormal (const df1b2vector &x, const df1b2variable &mu, const df1b2variable &sigma);
00224 dvariable   nllLognormal (const dvar_vector &x, const dvector &mu, const double sigma);
00225 dvariable   nllLognormal (const dvector &x, const dvar_vector &mu, const dvariable &sigma);
00226 dvariable   nllLognormal (const dvar_vector &x, const dvar_vector &mu, const dvariable &sigma);
00227 df1b2variable   nllLognormal (const df1b2vector &x, const dvector &mu, const double sigma);
00228 df1b2variable   nllLognormal (const dvector &x, const df1b2vector &mu, const df1b2variable &sigma);
00229 df1b2variable   nllLognormal (const df1b2vector &x, const df1b2vector &mu, const df1b2variable &sigma);
00230 dvariable   nllLognormal2 (const double x, const dvariable &mu, const dvariable &tau);
00231 dvariable   nllLognormal2 (const dvariable &x, const double mu, const double tau);
00232 dvariable   nllLognormal2 (const dvariable &x, const dvariable &mu, const dvariable &tau);
00233 df1b2variable   nllLognormal2 (const df1b2variable x, const double mu, const double tau);
00234 df1b2variable   nllLognormal2 (const double x, const df1b2variable &mu, const df1b2variable &tau);
00235 df1b2variable   nllLognormal2 (const df1b2variable x, const df1b2variable &mu, const double tau);
00236 df1b2variable   nllLognormal2 (const df1b2variable x, const double mu, const df1b2variable &tau);
00237 df1b2variable   nllLognormal2 (const df1b2variable x, const df1b2variable &mu, const df1b2variable &tau);
00238 dvariable   nllLognormal2 (const dvar_vector &x, const double mu, const double tau);
00239 dvariable   nllLognormal2 (const dvector &x, const dvariable &mu, const dvariable &tau);
00240 dvariable   nllLognormal2 (const dvar_vector &x, const dvariable &mu, const dvariable &tau);
00241 df1b2variable   nllLognormal2 (const dvector &x, const df1b2variable &mu, const df1b2variable &tau);
00242 df1b2variable   nllLognormal2 (const df1b2vector &x, const double mu, const double tau);
00243 df1b2variable   nllLognormal2 (const df1b2vector &x, const df1b2variable &mu, const double tau);
00244 df1b2variable   nllLognormal2 (const df1b2vector &x, const double mu, const df1b2variable &tau);
00245 df1b2variable   nllLognormal2 (const df1b2vector &x, const df1b2variable &mu, const df1b2variable &tau);
00246 dvariable   nllLognormal2 (const dvar_vector &x, const dvector &mu, const double tau);
00247 dvariable   nllLognormal2 (const dvector &x, const dvar_vector &mu, const dvariable &tau);
00248 dvariable   nllLognormal2 (const dvar_vector &x, const dvar_vector &mu, const dvariable &tau);
00249 df1b2variable   nllLognormal2 (const df1b2vector &x, const dvector &mu, const double tau);
00250 df1b2variable   nllLognormal2 (const dvector &x, const df1b2vector &mu, const df1b2variable &tau);
00251 df1b2variable   nllLognormal2 (const df1b2vector &x, const df1b2vector &mu, const df1b2variable &tau);
00252 double  nllPoisson (const double x, const double lambda);
00253 dvariable   nllPoisson (const dvariable &x, const double lambda);
00254 dvariable   nllPoisson (const double x, const dvariable &lambda);
00255 dvariable   nllPoisson (const dvariable &x, const dvariable &lambda);
00256 df1b2variable   nllPoisson (const df1b2variable &x, const double lambda);
00257 df1b2variable   nllPoisson (const double x, const df1b2variable &lambda);
00258 df1b2variable   nllPoisson (const df1b2variable &x, const df1b2variable &lambda);
00259 dvariable   nllPoisson (const dvar_vector &x, const double lambda);
00260 dvariable   nllPoisson (const dvector &x, const dvariable &lambda);
00261 dvariable   nllPoisson (const dvar_vector &x, const dvariable &lambda);
00262 df1b2variable   nllPoisson (const dvector &x, const df1b2variable &lambda);
00263 df1b2variable   nllPoisson (const df1b2vector &x, const double lambda);
00264 df1b2variable   nllPoisson (const df1b2vector &x, const df1b2variable &lambda);
00265 double  nllInverseGamma (const double x, const double a, const double b);
00266 dvariable   nllInverseGamma (const dvariable &x, const double a, const double b);
00267 dvariable   nllInverseGamma (const double x, const dvariable &a, const dvariable &b);
00268 dvariable   nllInverseGamma (const dvariable &x, const dvariable &a, const dvariable &b);
00269 df1b2variable   nllInverseGamma (const df1b2variable &x, const double a, const double b);
00270 df1b2variable   nllInverseGamma (const double x, const df1b2variable &a, const df1b2variable &b);
00271 df1b2variable   nllInverseGamma (const df1b2variable &x, const df1b2variable &a, const double b);
00272 df1b2variable   nllInverseGamma (const df1b2variable &x, const double a, const df1b2variable &b);
00273 df1b2variable   nllInverseGamma (const df1b2variable &x, const df1b2variable &a, const df1b2variable &b);
00274 dvariable   nllInverseGamma (const dvar_vector &x, const double a, const double b);
00275 dvariable   nllInverseGamma (const dvector &x, const dvariable &a, const dvariable &b);
00276 dvariable   nllInverseGamma (const dvar_vector &x, const dvariable &a, const dvariable &b);
00277 df1b2variable   nllInverseGamma (const dvector &x, const df1b2variable &a, const df1b2variable &b);
00278 df1b2variable   nllInverseGamma (const df1b2vector &x, const double a, const double b);
00279 df1b2variable   nllInverseGamma (const df1b2vector &x, const df1b2variable &a, const df1b2variable &b);
00280 #endif