diff --git a/src/gmacs.tpl b/src/gmacs.tpl index 72e44770..eebb2d6e 100644 --- a/src/gmacs.tpl +++ b/src/gmacs.tpl @@ -788,6 +788,9 @@ PRELIMINARY_CALCS_SECTION } } + + + PROCEDURE_SECTION // Initialize model parameters initialize_model_parameters(); diff --git a/src/include/nloglike.h b/src/include/nloglike.h index f0ec73c4..407df832 100644 --- a/src/include/nloglike.h +++ b/src/include/nloglike.h @@ -5,42 +5,7 @@ #define TINY 1.e-08 -namespace likelihoods -{ - -class nloglike -{ -private: - int r1; - int r2; - int c1; - int c2; - - ivector jmin; - ivector jmax; - - dmatrix m_O; - dmatrix m_Or; - dmatrix m_residual; - - dvar_matrix m_P; - dvar_matrix m_Pr; - -public: - ~nloglike(); - nloglike(const dmatrix& _O, const dvar_matrix& _P); - - void tail_compression(); - dvariable multinomial(const dvector& dSampleSize); - dvariable dmultinom(const dvector& x, const dvar_vector& p); - - dvariable dmvlogistic(); - - dmatrix residuals(const dvector& dSampleSize); - -}; -} // namespace diff --git a/src/lib/nloglike.cpp b/src/lib/nloglike.cpp index 6eaeaeba..55956605 100644 --- a/src/lib/nloglike.cpp +++ b/src/lib/nloglike.cpp @@ -5,167 +5,167 @@ #if defined _WIN32 || defined _WIN64 #include "include\nloglike.h" #endif -using namespace likelihoods; - - -nloglike::nloglike(const dmatrix& _O, const dvar_matrix& _P) -:m_O(_O),m_P(_P) -{ - r1 = m_O.rowmin(); - r2 = m_O.rowmax(); - c1 = m_O.colmin(); - c2 = m_O.colmax(); - tail_compression(); - m_residual.allocate(r1,r2,c1,c2); -} - -nloglike::~nloglike() -{ - -} - - /** - * @brief Multivariate logistic likelihood - * @details This is a modified version of the dmvlogistic negative log likelihood - where proportions at age less than minp are pooled into the consecutive - age-classes. See last paragraph in Appendix A of Richards, Schnute and - Olsen 1997. - * @return negative log likelihood. - */ -dvariable nloglike::dmvlogistic() -{ +// using namespace likelihoods; + + +// nloglike::nloglike(const dmatrix& _O, const dvar_matrix& _P) +// :m_O(_O),m_P(_P) +// { +// r1 = m_O.rowmin(); +// r2 = m_O.rowmax(); +// c1 = m_O.colmin(); +// c2 = m_O.colmax(); +// tail_compression(); +// m_residual.allocate(r1,r2,c1,c2); +// } + +// nloglike::~nloglike() +// { + +// } + +// /** +// * @brief Multivariate logistic likelihood +// * @details This is a modified version of the dmvlogistic negative log likelihood +// where proportions at age less than minp are pooled into the consecutive +// age-classes. See last paragraph in Appendix A of Richards, Schnute and +// Olsen 1997. +// * @return negative log likelihood. +// */ +// dvariable nloglike::dmvlogistic() +// { - int n = 0; - dvariable nll = 0; - dvar_matrix nu; - nu.allocate(m_Pr); - nu.initialize(); +// int n = 0; +// dvariable nll = 0; +// dvar_matrix nu; +// nu.allocate(m_Pr); +// nu.initialize(); - for(int i = r1; i <= r2; i++ ) - { - if(min(m_Pr(i))==0) {cout<<"Deal with zeros"<