// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#ifndef RCPP_trajeRprod_RCPPEXPORTS_H_GEN_
#define RCPP_trajeRprod_RCPPEXPORTS_H_GEN_

#include <RcppArmadillo.h>
#include <Rcpp.h>

namespace trajeRprod {

    using namespace Rcpp;

    namespace {
        void validateSignature(const char* sig) {
            Rcpp::Function require = Rcpp::Environment::base_env()["require"];
            require("trajeRprod", Rcpp::Named("quietly") = true);
            typedef int(*Ptr_validate)(const char*);
            static Ptr_validate p_validate = (Ptr_validate)
                R_GetCCallable("trajeRprod", "_trajeRprod_RcppExport_validate");
            if (!p_validate(sig)) {
                throw Rcpp::function_not_exported(
                    "C++ function with signature '" + std::string(sig) + "' not found in trajeRprod");
            }
        }
    }

    inline double gkBETA_cpp(List beta, List phi, int i, int k, IntegerVector nbeta, IntegerVector nphi, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkBETA_cpp p_gkBETA_cpp = NULL;
        if (p_gkBETA_cpp == NULL) {
            validateSignature("double(*gkBETA_cpp)(List,List,int,int,IntegerVector,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkBETA_cpp = (Ptr_gkBETA_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkBETA_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(phi)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nphi)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLBETA_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLBETA_cpp p_difLBETA_cpp = NULL;
        if (p_difLBETA_cpp == NULL) {
            validateSignature("NumericVector(*difLBETA_cpp)(NumericVector,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLBETA_cpp = (Ptr_difLBETA_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLBETA_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nphi)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double LikelihoodBETA_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_LikelihoodBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_LikelihoodBETA_cpp p_LikelihoodBETA_cpp = NULL;
        if (p_LikelihoodBETA_cpp == NULL) {
            validateSignature("double(*LikelihoodBETA_cpp)(NumericVector,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_LikelihoodBETA_cpp = (Ptr_LikelihoodBETA_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_LikelihoodBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_LikelihoodBETA_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nphi)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double gkCNORM_cpp(List beta, NumericVector sigma, int i, int k, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkCNORM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkCNORM_cpp p_gkCNORM_cpp = NULL;
        if (p_gkCNORM_cpp == NULL) {
            validateSignature("double(*gkCNORM_cpp)(List,NumericVector,int,int,IntegerVector,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkCNORM_cpp = (Ptr_gkCNORM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkCNORM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkCNORM_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(sigma)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double gkalpha_cpp(List beta, NumericVector alpha, int i, int k, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkalpha_cpp p_gkalpha_cpp = NULL;
        if (p_gkalpha_cpp == NULL) {
            validateSignature("double(*gkalpha_cpp)(List,NumericVector,int,int,IntegerVector,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkalpha_cpp = (Ptr_gkalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkalpha_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLthetakalpha_cpp(NumericVector theta, List beta, NumericVector alpha, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLthetakalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLthetakalpha_cpp p_difLthetakalpha_cpp = NULL;
        if (p_difLthetakalpha_cpp == NULL) {
            validateSignature("NumericVector(*difLthetakalpha_cpp)(NumericVector,List,NumericVector,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difLthetakalpha_cpp = (Ptr_difLthetakalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLthetakalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLthetakalpha_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector difLbetakalpha_cpp(NumericVector theta, List beta, NumericVector alpha, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetakalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetakalpha_cpp p_difLbetakalpha_cpp = NULL;
        if (p_difLbetakalpha_cpp == NULL) {
            validateSignature("NumericVector(*difLbetakalpha_cpp)(NumericVector,List,NumericVector,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difLbetakalpha_cpp = (Ptr_difLbetakalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLbetakalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetakalpha_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector difLdeltakalpha_cpp(NumericVector theta, List beta, NumericVector alpha, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> initTCOV, int nw) {
        typedef SEXP(*Ptr_difLdeltakalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLdeltakalpha_cpp p_difLdeltakalpha_cpp = NULL;
        if (p_difLdeltakalpha_cpp == NULL) {
            validateSignature("NumericVector(*difLdeltakalpha_cpp)(NumericVector,List,NumericVector,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difLdeltakalpha_cpp = (Ptr_difLdeltakalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLdeltakalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLdeltakalpha_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(initTCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double difLsigmakalpha_cpp(NumericVector theta, List beta, NumericVector alpha, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLsigmakalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLsigmakalpha_cpp p_difLsigmakalpha_cpp = NULL;
        if (p_difLsigmakalpha_cpp == NULL) {
            validateSignature("double(*difLsigmakalpha_cpp)(NumericVector,List,NumericVector,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difLsigmakalpha_cpp = (Ptr_difLsigmakalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLsigmakalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLsigmakalpha_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double difLsigmaalphaunique_cpp(NumericVector theta, List beta, NumericVector alpha, Nullable<List> delta, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLsigmaalphaunique_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLsigmaalphaunique_cpp p_difLsigmaalphaunique_cpp = NULL;
        if (p_difLsigmaalphaunique_cpp == NULL) {
            validateSignature("double(*difLsigmaalphaunique_cpp)(NumericVector,List,NumericVector,Nullable<List>,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difLsigmaalphaunique_cpp = (Ptr_difLsigmaalphaunique_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLsigmaalphaunique_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLsigmaalphaunique_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLalpha_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, bool ssigma) {
        typedef SEXP(*Ptr_difLalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLalpha_cpp p_difLalpha_cpp = NULL;
        if (p_difLalpha_cpp == NULL) {
            validateSignature("NumericVector(*difLalpha_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,bool)");
            p_difLalpha_cpp = (Ptr_difLalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLalpha_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ssigma)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector difLalphaunique_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, bool ssigma) {
        typedef SEXP(*Ptr_difLalphaunique_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLalphaunique_cpp p_difLalphaunique_cpp = NULL;
        if (p_difLalphaunique_cpp == NULL) {
            validateSignature("NumericVector(*difLalphaunique_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,bool)");
            p_difLalphaunique_cpp = (Ptr_difLalphaunique_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLalphaunique_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLalphaunique_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ssigma)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double Likelihoodalpha_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, bool ssigma) {
        typedef SEXP(*Ptr_Likelihoodalpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_Likelihoodalpha_cpp p_Likelihoodalpha_cpp = NULL;
        if (p_Likelihoodalpha_cpp == NULL) {
            validateSignature("double(*Likelihoodalpha_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,bool)");
            p_Likelihoodalpha_cpp = (Ptr_Likelihoodalpha_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_Likelihoodalpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_Likelihoodalpha_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ssigma)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double likelihoodCNORM_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_likelihoodCNORM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodCNORM_cpp p_likelihoodCNORM_cpp = NULL;
        if (p_likelihoodCNORM_cpp == NULL) {
            validateSignature("double(*likelihoodCNORM_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_likelihoodCNORM_cpp = (Ptr_likelihoodCNORM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodCNORM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodCNORM_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double likelihoodEM_cpp(int n, int ng, IntegerVector nbeta, NumericVector beta, NumericVector sigma, NumericVector pi, NumericMatrix A, NumericMatrix Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw) {
        typedef SEXP(*Ptr_likelihoodEM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodEM_cpp p_likelihoodEM_cpp = NULL;
        if (p_likelihoodEM_cpp == NULL) {
            validateSignature("double(*likelihoodEM_cpp)(int,int,IntegerVector,NumericVector,NumericVector,NumericVector,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_likelihoodEM_cpp = (Ptr_likelihoodEM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodEM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodEM_cpp(Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(sigma)), Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericMatrix ftauxCNORM_cpp(NumericVector pi, NumericVector beta, NumericVector sigma, int ng, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, int nx, NumericMatrix X) {
        typedef SEXP(*Ptr_ftauxCNORM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ftauxCNORM_cpp p_ftauxCNORM_cpp = NULL;
        if (p_ftauxCNORM_cpp == NULL) {
            validateSignature("NumericMatrix(*ftauxCNORM_cpp)(NumericVector,NumericVector,NumericVector,int,IntegerVector,int,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,Nullable<NumericVector>,int,int,NumericMatrix)");
            p_ftauxCNORM_cpp = (Ptr_ftauxCNORM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_ftauxCNORM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ftauxCNORM_cpp(Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(sigma)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(X)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericVector EM_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EM_cpp p_EM_cpp = NULL;
        if (p_EM_cpp == NULL) {
            validateSignature("NumericVector(*EM_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EM_cpp = (Ptr_EM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EM_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector EMSigmaunique_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMSigmaunique_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMSigmaunique_cpp p_EMSigmaunique_cpp = NULL;
        if (p_EMSigmaunique_cpp == NULL) {
            validateSignature("NumericVector(*EMSigmaunique_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMSigmaunique_cpp = (Ptr_EMSigmaunique_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMSigmaunique_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMSigmaunique_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector EMCensored_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMCensored_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMCensored_cpp p_EMCensored_cpp = NULL;
        if (p_EMCensored_cpp == NULL) {
            validateSignature("NumericVector(*EMCensored_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMCensored_cpp = (Ptr_EMCensored_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMCensored_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMCensored_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector EMCensoredSigmaunique_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, double ymin, double ymax, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMCensoredSigmaunique_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMCensoredSigmaunique_cpp p_EMCensoredSigmaunique_cpp = NULL;
        if (p_EMCensoredSigmaunique_cpp == NULL) {
            validateSignature("NumericVector(*EMCensoredSigmaunique_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMCensoredSigmaunique_cpp = (Ptr_EMCensoredSigmaunique_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMCensoredSigmaunique_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMCensoredSigmaunique_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double piikIntern_cpp(NumericVector theta, int i, int k, int ng, NumericMatrix X) {
        typedef SEXP(*Ptr_piikIntern_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_piikIntern_cpp p_piikIntern_cpp = NULL;
        if (p_piikIntern_cpp == NULL) {
            validateSignature("double(*piikIntern_cpp)(NumericVector,int,int,int,NumericMatrix)");
            p_piikIntern_cpp = (Ptr_piikIntern_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_piikIntern_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_piikIntern_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(X)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector muikt_cpp(NumericVector beta, int nbeta, int i, int period, NumericMatrix A, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw, int k) {
        typedef SEXP(*Ptr_muikt_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_muikt_cpp p_muikt_cpp = NULL;
        if (p_muikt_cpp == NULL) {
            validateSignature("NumericVector(*muikt_cpp)(NumericVector,int,int,int,NumericMatrix,Nullable<NumericMatrix>,Nullable<List>,int,int)");
            p_muikt_cpp = (Ptr_muikt_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_muikt_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_muikt_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(k)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double ftheta_cpp(NumericVector theta, NumericMatrix taux, NumericMatrix X, int n, int ng, int period) {
        typedef SEXP(*Ptr_ftheta_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ftheta_cpp p_ftheta_cpp = NULL;
        if (p_ftheta_cpp == NULL) {
            validateSignature("double(*ftheta_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int)");
            p_ftheta_cpp = (Ptr_ftheta_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_ftheta_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ftheta_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(period)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difftheta_cpp(NumericVector theta, NumericMatrix taux, NumericMatrix X, int n, int ng, int period) {
        typedef SEXP(*Ptr_difftheta_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difftheta_cpp p_difftheta_cpp = NULL;
        if (p_difftheta_cpp == NULL) {
            validateSignature("NumericVector(*difftheta_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int)");
            p_difftheta_cpp = (Ptr_difftheta_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difftheta_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difftheta_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(period)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline Rcpp::NumericVector thethaIRLS_cpp(Rcpp::NumericVector thetaIRLS, int n, int ng, Rcpp::NumericMatrix X, arma::mat taux, int refgr) {
        typedef SEXP(*Ptr_thethaIRLS_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_thethaIRLS_cpp p_thethaIRLS_cpp = NULL;
        if (p_thethaIRLS_cpp == NULL) {
            validateSignature("Rcpp::NumericVector(*thethaIRLS_cpp)(Rcpp::NumericVector,int,int,Rcpp::NumericMatrix,arma::mat,int)");
            p_thethaIRLS_cpp = (Ptr_thethaIRLS_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_thethaIRLS_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_thethaIRLS_cpp(Shield<SEXP>(Rcpp::wrap(thetaIRLS)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<Rcpp::NumericVector >(rcpp_result_gen);
    }

    inline NumericVector findtheta_cpp(NumericVector theta, NumericMatrix taux, NumericMatrix X, int n, int ng, int nx, int period, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_findtheta_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_findtheta_cpp p_findtheta_cpp = NULL;
        if (p_findtheta_cpp == NULL) {
            validateSignature("NumericVector(*findtheta_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,bool,int)");
            p_findtheta_cpp = (Ptr_findtheta_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_findtheta_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_findtheta_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double gkLOGIT_cpp(List beta, int i, int k, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkLOGIT_cpp p_gkLOGIT_cpp = NULL;
        if (p_gkLOGIT_cpp == NULL) {
            validateSignature("double(*gkLOGIT_cpp)(List,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkLOGIT_cpp = (Ptr_gkLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLLOGIT_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLLOGIT_cpp p_difLLOGIT_cpp = NULL;
        if (p_difLLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difLLOGIT_cpp)(NumericVector,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLLOGIT_cpp = (Ptr_difLLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double likelihoodLOGIT_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_likelihoodLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodLOGIT_cpp p_likelihoodLOGIT_cpp = NULL;
        if (p_likelihoodLOGIT_cpp == NULL) {
            validateSignature("double(*likelihoodLOGIT_cpp)(NumericVector,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_likelihoodLOGIT_cpp = (Ptr_likelihoodLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericMatrix ftauxLOGIT_cpp(NumericVector pi, NumericVector beta, int ng, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, int nx, NumericMatrix X) {
        typedef SEXP(*Ptr_ftauxLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ftauxLOGIT_cpp p_ftauxLOGIT_cpp = NULL;
        if (p_ftauxLOGIT_cpp == NULL) {
            validateSignature("NumericMatrix(*ftauxLOGIT_cpp)(NumericVector,NumericVector,int,IntegerVector,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,int,NumericMatrix)");
            p_ftauxLOGIT_cpp = (Ptr_ftauxLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_ftauxLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ftauxLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(X)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline double likelihoodEMLOGIT_cpp(int n, int ng, IntegerVector nbeta, NumericVector beta, NumericVector pi, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw) {
        typedef SEXP(*Ptr_likelihoodEMLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodEMLOGIT_cpp p_likelihoodEMLOGIT_cpp = NULL;
        if (p_likelihoodEMLOGIT_cpp == NULL) {
            validateSignature("double(*likelihoodEMLOGIT_cpp)(int,int,IntegerVector,NumericVector,NumericVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_likelihoodEMLOGIT_cpp = (Ptr_likelihoodEMLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodEMLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodEMLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector EMLOGIT_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMLOGIT_cpp p_EMLOGIT_cpp = NULL;
        if (p_EMLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*EMLOGIT_cpp)(NumericVector,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMLOGIT_cpp = (Ptr_EMLOGIT_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector EMLOGITIRLS_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOVinit, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMLOGITIRLS_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMLOGITIRLS_cpp p_EMLOGITIRLS_cpp = NULL;
        if (p_EMLOGITIRLS_cpp == NULL) {
            validateSignature("NumericVector(*EMLOGITIRLS_cpp)(NumericVector,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMLOGITIRLS_cpp = (Ptr_EMLOGITIRLS_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMLOGITIRLS_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMLOGITIRLS_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOVinit)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double gkPois_cpp(List beta, int i, int k, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkPois_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkPois_cpp p_gkPois_cpp = NULL;
        if (p_gkPois_cpp == NULL) {
            validateSignature("double(*gkPois_cpp)(List,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkPois_cpp = (Ptr_gkPois_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkPois_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkPois_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLbetakPois_cpp(NumericVector theta, List beta, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetakPois_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetakPois_cpp p_difLbetakPois_cpp = NULL;
        if (p_difLbetakPois_cpp == NULL) {
            validateSignature("NumericVector(*difLbetakPois_cpp)(NumericVector,List,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetakPois_cpp = (Ptr_difLbetakPois_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLbetakPois_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetakPois_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector difLPois_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLPois_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLPois_cpp p_difLPois_cpp = NULL;
        if (p_difLPois_cpp == NULL) {
            validateSignature("NumericVector(*difLPois_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLPois_cpp = (Ptr_difLPois_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLPois_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLPois_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double likelihoodPois_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_likelihoodPois_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodPois_cpp p_likelihoodPois_cpp = NULL;
        if (p_likelihoodPois_cpp == NULL) {
            validateSignature("double(*likelihoodPois_cpp)(NumericVector,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_likelihoodPois_cpp = (Ptr_likelihoodPois_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodPois_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodPois_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double gkZIP_cpp(List beta, List nu, int i, int k, IntegerVector nbeta, IntegerVector nnu, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw) {
        typedef SEXP(*Ptr_gkZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_gkZIP_cpp p_gkZIP_cpp = NULL;
        if (p_gkZIP_cpp == NULL) {
            validateSignature("double(*gkZIP_cpp)(List,List,int,int,IntegerVector,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<List>,int)");
            p_gkZIP_cpp = (Ptr_gkZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_gkZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_gkZIP_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericVector difLZIP_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLZIP_cpp p_difLZIP_cpp = NULL;
        if (p_difLZIP_cpp == NULL) {
            validateSignature("NumericVector(*difLZIP_cpp)(NumericVector,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLZIP_cpp = (Ptr_difLZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLZIP_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline double likelihoodZIP_cpp(NumericVector param, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_likelihoodZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodZIP_cpp p_likelihoodZIP_cpp = NULL;
        if (p_likelihoodZIP_cpp == NULL) {
            validateSignature("double(*likelihoodZIP_cpp)(NumericVector,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_likelihoodZIP_cpp = (Ptr_likelihoodZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodZIP_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double likelihoodEMZIP_cpp(int n, int ng, IntegerVector nbeta, IntegerVector nnu, NumericVector beta, NumericVector nu, NumericVector pi, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw) {
        typedef SEXP(*Ptr_likelihoodEMZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodEMZIP_cpp p_likelihoodEMZIP_cpp = NULL;
        if (p_likelihoodEMZIP_cpp == NULL) {
            validateSignature("double(*likelihoodEMZIP_cpp)(int,int,IntegerVector,IntegerVector,NumericVector,NumericVector,NumericVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_likelihoodEMZIP_cpp = (Ptr_likelihoodEMZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodEMZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodEMZIP_cpp(Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline NumericMatrix ftauxZIP_cpp(NumericVector pi, NumericVector beta, NumericVector nu, int ng, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, int nx, NumericMatrix X) {
        typedef SEXP(*Ptr_ftauxZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ftauxZIP_cpp p_ftauxZIP_cpp = NULL;
        if (p_ftauxZIP_cpp == NULL) {
            validateSignature("NumericMatrix(*ftauxZIP_cpp)(NumericVector,NumericVector,NumericVector,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,int,NumericMatrix)");
            p_ftauxZIP_cpp = (Ptr_ftauxZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_ftauxZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ftauxZIP_cpp(Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(X)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericMatrix >(rcpp_result_gen);
    }

    inline NumericVector EMZIP_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, IntegerVector nnu, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMZIP_cpp p_EMZIP_cpp = NULL;
        if (p_EMZIP_cpp == NULL) {
            validateSignature("NumericVector(*EMZIP_cpp)(NumericVector,int,int,int,IntegerVector,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMZIP_cpp = (Ptr_EMZIP_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMZIP_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline NumericVector EMZIPIRLS_cpp(NumericVector param, int ng, int nx, int n, IntegerVector nbeta, IntegerVector nnu, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOVinit, int nw, int itermax, bool EMIRLS, int refgr) {
        typedef SEXP(*Ptr_EMZIPIRLS_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMZIPIRLS_cpp p_EMZIPIRLS_cpp = NULL;
        if (p_EMZIPIRLS_cpp == NULL) {
            validateSignature("NumericVector(*EMZIPIRLS_cpp)(NumericVector,int,int,int,IntegerVector,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int,int,bool,int)");
            p_EMZIPIRLS_cpp = (Ptr_EMZIPIRLS_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMZIPIRLS_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMZIPIRLS_cpp(Shield<SEXP>(Rcpp::wrap(param)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nx)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(X)), Shield<SEXP>(Rcpp::wrap(TCOVinit)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)), Shield<SEXP>(Rcpp::wrap(refgr)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<NumericVector >(rcpp_result_gen);
    }

    inline List convtolist_cpp(arma::vec v, arma::vec nelt) {
        typedef SEXP(*Ptr_convtolist_cpp)(SEXP,SEXP);
        static Ptr_convtolist_cpp p_convtolist_cpp = NULL;
        if (p_convtolist_cpp == NULL) {
            validateSignature("List(*convtolist_cpp)(arma::vec,arma::vec)");
            p_convtolist_cpp = (Ptr_convtolist_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_convtolist_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_convtolist_cpp(Shield<SEXP>(Rcpp::wrap(v)), Shield<SEXP>(Rcpp::wrap(nelt)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

    inline arma::mat mPsi_cpp(arma::vec psi, List lng) {
        typedef SEXP(*Ptr_mPsi_cpp)(SEXP,SEXP);
        static Ptr_mPsi_cpp p_mPsi_cpp = NULL;
        if (p_mPsi_cpp == NULL) {
            validateSignature("arma::mat(*mPsi_cpp)(arma::vec,List)");
            p_mPsi_cpp = (Ptr_mPsi_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_mPsi_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_mPsi_cpp(Shield<SEXP>(Rcpp::wrap(psi)), Shield<SEXP>(Rcpp::wrap(lng)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<arma::mat >(rcpp_result_gen);
    }

    inline double piikMult_cpp(List ltheta, arma::mat mPsi, int i, arma::vec vk, List lng, List lX, arma::mat mk) {
        typedef SEXP(*Ptr_piikMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_piikMult_cpp p_piikMult_cpp = NULL;
        if (p_piikMult_cpp == NULL) {
            validateSignature("double(*piikMult_cpp)(List,arma::mat,int,arma::vec,List,List,arma::mat)");
            p_piikMult_cpp = (Ptr_piikMult_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_piikMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_piikMult_cpp(Shield<SEXP>(Rcpp::wrap(ltheta)), Shield<SEXP>(Rcpp::wrap(mPsi)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(vk)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(mk)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double densityChoice_cpp(List beta, Nullable<NumericVector> alphainit, int i, int k, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw, Nullable<List> nuinit, Nullable<IntegerVector> nnuinit, std::string model) {
        typedef SEXP(*Ptr_densityChoice_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_densityChoice_cpp p_densityChoice_cpp = NULL;
        if (p_densityChoice_cpp == NULL) {
            validateSignature("double(*densityChoice_cpp)(List,Nullable<NumericVector>,int,int,IntegerVector,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,Nullable<List>,int,Nullable<List>,Nullable<IntegerVector>,std::string)");
            p_densityChoice_cpp = (Ptr_densityChoice_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_densityChoice_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_densityChoice_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alphainit)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(ymin)), Shield<SEXP>(Rcpp::wrap(ymax)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(nuinit)), Shield<SEXP>(Rcpp::wrap(nnuinit)), Shield<SEXP>(Rcpp::wrap(model)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline double likelihoodMult_cpp(arma::vec vparam, List lng, List lnx, List lnbeta, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List lnw, arma::vec vp, arma::mat mk, List lnnu, std::vector<std::string> model) {
        typedef SEXP(*Ptr_likelihoodMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodMult_cpp p_likelihoodMult_cpp = NULL;
        if (p_likelihoodMult_cpp == NULL) {
            validateSignature("double(*likelihoodMult_cpp)(arma::vec,List,List,List,List,List,List,List,List,List,Nullable<List>,List,arma::vec,arma::mat,List,std::vector<std::string>)");
            p_likelihoodMult_cpp = (Ptr_likelihoodMult_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodMult_cpp(Shield<SEXP>(Rcpp::wrap(vparam)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lnx)), Shield<SEXP>(Rcpp::wrap(lnbeta)), Shield<SEXP>(Rcpp::wrap(ln)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(lY)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(lymin)), Shield<SEXP>(Rcpp::wrap(lymax)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(lnw)), Shield<SEXP>(Rcpp::wrap(vp)), Shield<SEXP>(Rcpp::wrap(mk)), Shield<SEXP>(Rcpp::wrap(lnnu)), Shield<SEXP>(Rcpp::wrap(model)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline arma::rowvec difLalphaMult_cpp(arma::vec vparam, List lng, List lnx, List lnbeta, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List lnw, arma::vec vp, arma::mat mk, List lnnu, std::vector<std::string> model) {
        typedef SEXP(*Ptr_difLalphaMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLalphaMult_cpp p_difLalphaMult_cpp = NULL;
        if (p_difLalphaMult_cpp == NULL) {
            validateSignature("arma::rowvec(*difLalphaMult_cpp)(arma::vec,List,List,List,List,List,List,List,List,List,Nullable<List>,List,arma::vec,arma::mat,List,std::vector<std::string>)");
            p_difLalphaMult_cpp = (Ptr_difLalphaMult_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_difLalphaMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLalphaMult_cpp(Shield<SEXP>(Rcpp::wrap(vparam)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lnx)), Shield<SEXP>(Rcpp::wrap(lnbeta)), Shield<SEXP>(Rcpp::wrap(ln)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(lY)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(lymin)), Shield<SEXP>(Rcpp::wrap(lymax)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(lnw)), Shield<SEXP>(Rcpp::wrap(vp)), Shield<SEXP>(Rcpp::wrap(mk)), Shield<SEXP>(Rcpp::wrap(lnnu)), Shield<SEXP>(Rcpp::wrap(model)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<arma::rowvec >(rcpp_result_gen);
    }

    inline List ftauxPiikMult_cpp(List lthetainit, arma::mat mPsi, List lbeta, Nullable<List> lsigmainit, List lng, List lnbeta, List ln, List lA, List lY, List lymin, List lymax, Nullable<List> lTCOVinit, List ldelta, List lnw, List lnx, List lX, arma::mat mk, arma::vec vp, Nullable<List> nuinit, Nullable<List> nnuinit, std::vector<std::string> model) {
        typedef SEXP(*Ptr_ftauxPiikMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ftauxPiikMult_cpp p_ftauxPiikMult_cpp = NULL;
        if (p_ftauxPiikMult_cpp == NULL) {
            validateSignature("List(*ftauxPiikMult_cpp)(List,arma::mat,List,Nullable<List>,List,List,List,List,List,List,List,Nullable<List>,List,List,List,List,arma::mat,arma::vec,Nullable<List>,Nullable<List>,std::vector<std::string>)");
            p_ftauxPiikMult_cpp = (Ptr_ftauxPiikMult_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_ftauxPiikMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ftauxPiikMult_cpp(Shield<SEXP>(Rcpp::wrap(lthetainit)), Shield<SEXP>(Rcpp::wrap(mPsi)), Shield<SEXP>(Rcpp::wrap(lbeta)), Shield<SEXP>(Rcpp::wrap(lsigmainit)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lnbeta)), Shield<SEXP>(Rcpp::wrap(ln)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(lY)), Shield<SEXP>(Rcpp::wrap(lymin)), Shield<SEXP>(Rcpp::wrap(lymax)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(ldelta)), Shield<SEXP>(Rcpp::wrap(lnw)), Shield<SEXP>(Rcpp::wrap(lnx)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(mk)), Shield<SEXP>(Rcpp::wrap(vp)), Shield<SEXP>(Rcpp::wrap(nuinit)), Shield<SEXP>(Rcpp::wrap(nnuinit)), Shield<SEXP>(Rcpp::wrap(model)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

    inline double likelihoodMultEM_cpp(List lthetainit, arma::mat mPsi, List lbeta, Nullable<List> lsigmainit, List lng, List lnx, List lnbeta, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List ldelta, List lnw, arma::mat mk, arma::mat mprob, arma::vec vp, Nullable<List> nuinit, Nullable<List> nnuinit, std::vector<std::string> model) {
        typedef SEXP(*Ptr_likelihoodMultEM_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_likelihoodMultEM_cpp p_likelihoodMultEM_cpp = NULL;
        if (p_likelihoodMultEM_cpp == NULL) {
            validateSignature("double(*likelihoodMultEM_cpp)(List,arma::mat,List,Nullable<List>,List,List,List,List,List,List,List,List,List,Nullable<List>,List,List,arma::mat,arma::mat,arma::vec,Nullable<List>,Nullable<List>,std::vector<std::string>)");
            p_likelihoodMultEM_cpp = (Ptr_likelihoodMultEM_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_likelihoodMultEM_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_likelihoodMultEM_cpp(Shield<SEXP>(Rcpp::wrap(lthetainit)), Shield<SEXP>(Rcpp::wrap(mPsi)), Shield<SEXP>(Rcpp::wrap(lbeta)), Shield<SEXP>(Rcpp::wrap(lsigmainit)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lnx)), Shield<SEXP>(Rcpp::wrap(lnbeta)), Shield<SEXP>(Rcpp::wrap(ln)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(lY)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(lymin)), Shield<SEXP>(Rcpp::wrap(lymax)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(ldelta)), Shield<SEXP>(Rcpp::wrap(lnw)), Shield<SEXP>(Rcpp::wrap(mk)), Shield<SEXP>(Rcpp::wrap(mprob)), Shield<SEXP>(Rcpp::wrap(vp)), Shield<SEXP>(Rcpp::wrap(nuinit)), Shield<SEXP>(Rcpp::wrap(nnuinit)), Shield<SEXP>(Rcpp::wrap(model)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<double >(rcpp_result_gen);
    }

    inline List EMCNORMparam(arma::vec beta, int nw, int ng, int n, int period, int j, arma::vec nbeta, arma::mat Y, List lA, arma::mat taux, arma::vec nbetacum, Nullable<List> lTCOV, Nullable<List> ldelta) {
        typedef SEXP(*Ptr_EMCNORMparam)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMCNORMparam p_EMCNORMparam = NULL;
        if (p_EMCNORMparam == NULL) {
            validateSignature("List(*EMCNORMparam)(arma::vec,int,int,int,int,int,arma::vec,arma::mat,List,arma::mat,arma::vec,Nullable<List>,Nullable<List>)");
            p_EMCNORMparam = (Ptr_EMCNORMparam)R_GetCCallable("trajeRprod", "_trajeRprod_EMCNORMparam");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMCNORMparam(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(j)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(nbetacum)), Shield<SEXP>(Rcpp::wrap(lTCOV)), Shield<SEXP>(Rcpp::wrap(ldelta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

    inline List EMLOGITparam(arma::vec beta, int nw, int ng, int n, int period, int j, arma::vec nbeta, arma::mat Y, List lA, arma::mat taux, arma::vec nbetacum, Nullable<List> lTCOV, Nullable<List> ldelta) {
        typedef SEXP(*Ptr_EMLOGITparam)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMLOGITparam p_EMLOGITparam = NULL;
        if (p_EMLOGITparam == NULL) {
            validateSignature("List(*EMLOGITparam)(arma::vec,int,int,int,int,int,arma::vec,arma::mat,List,arma::mat,arma::vec,Nullable<List>,Nullable<List>)");
            p_EMLOGITparam = (Ptr_EMLOGITparam)R_GetCCallable("trajeRprod", "_trajeRprod_EMLOGITparam");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMLOGITparam(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(j)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(nbetacum)), Shield<SEXP>(Rcpp::wrap(lTCOV)), Shield<SEXP>(Rcpp::wrap(ldelta)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

    inline List EMZIPparam(arma::vec beta, arma::vec nu, int nw, int ng, int n, int period, int j, arma::vec nbeta, arma::vec nnu, arma::mat Y, List lA, arma::mat taux, arma::vec nbetacum, arma::vec nnucum, Nullable<IntegerVector> ndeltacum, Nullable<List> lTCOVinit, Nullable<List> ldeltainit) {
        typedef SEXP(*Ptr_EMZIPparam)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMZIPparam p_EMZIPparam = NULL;
        if (p_EMZIPparam == NULL) {
            validateSignature("List(*EMZIPparam)(arma::vec,arma::vec,int,int,int,int,int,arma::vec,arma::vec,arma::mat,List,arma::mat,arma::vec,arma::vec,Nullable<IntegerVector>,Nullable<List>,Nullable<List>)");
            p_EMZIPparam = (Ptr_EMZIPparam)R_GetCCallable("trajeRprod", "_trajeRprod_EMZIPparam");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMZIPparam(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(nw)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(j)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(nbetacum)), Shield<SEXP>(Rcpp::wrap(nnucum)), Shield<SEXP>(Rcpp::wrap(ndeltacum)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(ldeltainit)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

    inline List EMMult_cpp(List lparam, List lng, List lnx, List lnbeta, List lnnu, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List lnw, arma::mat mk, arma::vec vp, std::vector<std::string> model, int itermax, bool EMIRLS) {
        typedef SEXP(*Ptr_EMMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMMult_cpp p_EMMult_cpp = NULL;
        if (p_EMMult_cpp == NULL) {
            validateSignature("List(*EMMult_cpp)(List,List,List,List,List,List,List,List,List,List,List,Nullable<List>,List,arma::mat,arma::vec,std::vector<std::string>,int,bool)");
            p_EMMult_cpp = (Ptr_EMMult_cpp)R_GetCCallable("trajeRprod", "_trajeRprod_EMMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMMult_cpp(Shield<SEXP>(Rcpp::wrap(lparam)), Shield<SEXP>(Rcpp::wrap(lng)), Shield<SEXP>(Rcpp::wrap(lnx)), Shield<SEXP>(Rcpp::wrap(lnbeta)), Shield<SEXP>(Rcpp::wrap(lnnu)), Shield<SEXP>(Rcpp::wrap(ln)), Shield<SEXP>(Rcpp::wrap(lA)), Shield<SEXP>(Rcpp::wrap(lY)), Shield<SEXP>(Rcpp::wrap(lX)), Shield<SEXP>(Rcpp::wrap(lymin)), Shield<SEXP>(Rcpp::wrap(lymax)), Shield<SEXP>(Rcpp::wrap(lTCOVinit)), Shield<SEXP>(Rcpp::wrap(lnw)), Shield<SEXP>(Rcpp::wrap(mk)), Shield<SEXP>(Rcpp::wrap(vp)), Shield<SEXP>(Rcpp::wrap(model)), Shield<SEXP>(Rcpp::wrap(itermax)), Shield<SEXP>(Rcpp::wrap(EMIRLS)));
        }
        if (rcpp_result_gen.inherits("interrupted-error"))
            throw Rcpp::internal::InterruptedException();
        if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))
            throw Rcpp::LongjumpException(rcpp_result_gen);
        if (rcpp_result_gen.inherits("try-error"))
            throw Rcpp::exception(Rcpp::as<std::string>(rcpp_result_gen).c_str());
        return Rcpp::as<List >(rcpp_result_gen);
    }

}

#endif // RCPP_trajeRprod_RCPPEXPORTS_H_GEN_
