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