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

#ifndef RCPP_trajeR_RCPPEXPORTS_H_GEN_
#define RCPP_trajeR_RCPPEXPORTS_H_GEN_

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

namespace trajeR {

    using namespace Rcpp;

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

    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("trajeR", "_trajeR_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 difLthetakBETA_cpp(NumericVector theta, List beta, List phi, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLthetakBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLthetakBETA_cpp p_difLthetakBETA_cpp = NULL;
        if (p_difLthetakBETA_cpp == NULL) {
            validateSignature("NumericVector(*difLthetakBETA_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLthetakBETA_cpp = (Ptr_difLthetakBETA_cpp)R_GetCCallable("trajeR", "_trajeR_difLthetakBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLthetakBETA_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(phi)), 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(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 NumericVector difLbetakBETA_cpp(NumericVector theta, List beta, List phi, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetakBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetakBETA_cpp p_difLbetakBETA_cpp = NULL;
        if (p_difLbetakBETA_cpp == NULL) {
            validateSignature("NumericVector(*difLbetakBETA_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetakBETA_cpp = (Ptr_difLbetakBETA_cpp)R_GetCCallable("trajeR", "_trajeR_difLbetakBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetakBETA_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(phi)), 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(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 NumericVector difLdeltakBETA_cpp(NumericVector theta, List beta, List phi, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> initTCOV, int nw) {
        typedef SEXP(*Ptr_difLdeltakBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLdeltakBETA_cpp p_difLdeltakBETA_cpp = NULL;
        if (p_difLdeltakBETA_cpp == NULL) {
            validateSignature("NumericVector(*difLdeltakBETA_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLdeltakBETA_cpp = (Ptr_difLdeltakBETA_cpp)R_GetCCallable("trajeR", "_trajeR_difLdeltakBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLdeltakBETA_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(phi)), 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(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(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 NumericVector difLphikBETA_cpp(NumericVector theta, List beta, List phi, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nphi, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLphikBETA_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLphikBETA_cpp p_difLphikBETA_cpp = NULL;
        if (p_difLphikBETA_cpp == NULL) {
            validateSignature("NumericVector(*difLphikBETA_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLphikBETA_cpp = (Ptr_difLphikBETA_cpp)R_GetCCallable("trajeR", "_trajeR_difLphikBETA_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLphikBETA_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(phi)), 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(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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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 difLthetakLOGIT_cpp(NumericVector theta, List beta, Nullable<List> delta, int k, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLthetakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLthetakLOGIT_cpp p_difLthetakLOGIT_cpp = NULL;
        if (p_difLthetakLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difLthetakLOGIT_cpp)(NumericVector,List,Nullable<List>,int,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLthetakLOGIT_cpp = (Ptr_difLthetakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difLthetakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLthetakLOGIT_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(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 NumericVector difLbetakLOGIT_cpp(NumericVector theta, List beta, Nullable<List> delta, int k, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetakLOGIT_cpp p_difLbetakLOGIT_cpp = NULL;
        if (p_difLbetakLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difLbetakLOGIT_cpp)(NumericVector,List,Nullable<List>,int,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetakLOGIT_cpp = (Ptr_difLbetakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difLbetakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetakLOGIT_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(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 NumericVector difLdeltakLOGIT_cpp(NumericVector theta, List beta, Nullable<List> delta, int k, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> initTCOV, int nw) {
        typedef SEXP(*Ptr_difLdeltakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLdeltakLOGIT_cpp p_difLdeltakLOGIT_cpp = NULL;
        if (p_difLdeltakLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difLdeltakLOGIT_cpp)(NumericVector,List,Nullable<List>,int,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLdeltakLOGIT_cpp = (Ptr_difLdeltakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difLdeltakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLdeltakLOGIT_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(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(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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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 QbetakLOGIT_cpp(NumericVector betak, NumericMatrix taux, int k, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> deltainit, int nw) {
        typedef SEXP(*Ptr_QbetakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QbetakLOGIT_cpp p_QbetakLOGIT_cpp = NULL;
        if (p_QbetakLOGIT_cpp == NULL) {
            validateSignature("double(*QbetakLOGIT_cpp)(NumericVector,NumericMatrix,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_QbetakLOGIT_cpp = (Ptr_QbetakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_QbetakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QbetakLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(betak)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(deltainit)), 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 QdeltakLOGIT_cpp(NumericVector deltak, NumericMatrix taux, int k, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, NumericVector beta, int nw) {
        typedef SEXP(*Ptr_QdeltakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QdeltakLOGIT_cpp p_QdeltakLOGIT_cpp = NULL;
        if (p_QdeltakLOGIT_cpp == NULL) {
            validateSignature("double(*QdeltakLOGIT_cpp)(NumericVector,NumericMatrix,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,NumericVector,int)");
            p_QdeltakLOGIT_cpp = (Ptr_QdeltakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_QdeltakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QdeltakLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(deltak)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(beta)), 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 difQbetakLOGIT_cpp(NumericVector betak, NumericMatrix taux, int k, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> deltainit, int nw) {
        typedef SEXP(*Ptr_difQbetakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQbetakLOGIT_cpp p_difQbetakLOGIT_cpp = NULL;
        if (p_difQbetakLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difQbetakLOGIT_cpp)(NumericVector,NumericMatrix,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_difQbetakLOGIT_cpp = (Ptr_difQbetakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difQbetakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQbetakLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(betak)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(deltainit)), 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 difQdeltakLOGIT_cpp(NumericVector deltak, NumericMatrix taux, int k, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix TCOV, NumericVector beta, int nw) {
        typedef SEXP(*Ptr_difQdeltakLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQdeltakLOGIT_cpp p_difQdeltakLOGIT_cpp = NULL;
        if (p_difQdeltakLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difQdeltakLOGIT_cpp)(NumericVector,NumericMatrix,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,NumericVector,int)");
            p_difQdeltakLOGIT_cpp = (Ptr_difQdeltakLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difQdeltakLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQdeltakLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(deltak)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), Shield<SEXP>(Rcpp::wrap(nbeta)), Shield<SEXP>(Rcpp::wrap(A)), Shield<SEXP>(Rcpp::wrap(Y)), Shield<SEXP>(Rcpp::wrap(TCOV)), Shield<SEXP>(Rcpp::wrap(beta)), 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 QbetaLOGIT_cpp(NumericVector beta, NumericMatrix taux, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw) {
        typedef SEXP(*Ptr_QbetaLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QbetaLOGIT_cpp p_QbetaLOGIT_cpp = NULL;
        if (p_QbetaLOGIT_cpp == NULL) {
            validateSignature("double(*QbetaLOGIT_cpp)(NumericVector,NumericMatrix,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_QbetaLOGIT_cpp = (Ptr_QbetaLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_QbetaLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QbetaLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), 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 difQbetaLOGIT_cpp(NumericVector beta, NumericMatrix taux, int n, int ng, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw) {
        typedef SEXP(*Ptr_difQbetaLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQbetaLOGIT_cpp p_difQbetaLOGIT_cpp = NULL;
        if (p_difQbetaLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difQbetaLOGIT_cpp)(NumericVector,NumericMatrix,int,int,IntegerVector,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int)");
            p_difQbetaLOGIT_cpp = (Ptr_difQbetaLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difQbetaLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQbetaLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(taux)), Shield<SEXP>(Rcpp::wrap(n)), Shield<SEXP>(Rcpp::wrap(ng)), 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<NumericVector >(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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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 difLthetakPois_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_difLthetakPois_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLthetakPois_cpp p_difLthetakPois_cpp = NULL;
        if (p_difLthetakPois_cpp == NULL) {
            validateSignature("NumericVector(*difLthetakPois_cpp)(NumericVector,List,Nullable<List>,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLthetakPois_cpp = (Ptr_difLthetakPois_cpp)R_GetCCallable("trajeR", "_trajeR_difLthetakPois_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLthetakPois_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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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 NumericVector nuikt_cpp(NumericVector nu, int nnu, int i, int period, NumericMatrix A, int k) {
        typedef SEXP(*Ptr_nuikt_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_nuikt_cpp p_nuikt_cpp = NULL;
        if (p_nuikt_cpp == NULL) {
            validateSignature("NumericVector(*nuikt_cpp)(NumericVector,int,int,int,NumericMatrix,int)");
            p_nuikt_cpp = (Ptr_nuikt_cpp)R_GetCCallable("trajeR", "_trajeR_nuikt_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_nuikt_cpp(Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(nnu)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(A)), 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 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("trajeR", "_trajeR_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 difLthetakZIP_cpp(NumericVector theta, List beta, List nu, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLthetakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLthetakZIP_cpp p_difLthetakZIP_cpp = NULL;
        if (p_difLthetakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difLthetakZIP_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLthetakZIP_cpp = (Ptr_difLthetakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLthetakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLthetakZIP_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), 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(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 NumericVector difLbetakZIP_cpp(NumericVector theta, List beta, List nu, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetakZIP_cpp p_difLbetakZIP_cpp = NULL;
        if (p_difLbetakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difLbetakZIP_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetakZIP_cpp = (Ptr_difLbetakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLbetakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetakZIP_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), 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(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 NumericVector difLnukZIP_cpp(NumericVector theta, List beta, List nu, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLnukZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLnukZIP_cpp p_difLnukZIP_cpp = NULL;
        if (p_difLnukZIP_cpp == NULL) {
            validateSignature("NumericVector(*difLnukZIP_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLnukZIP_cpp = (Ptr_difLnukZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLnukZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLnukZIP_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), 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(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 NumericVector difLdeltakZIP_cpp(NumericVector theta, List beta, List nu, Nullable<List> delta, int k, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOVinit, int nw) {
        typedef SEXP(*Ptr_difLdeltakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLdeltakZIP_cpp p_difLdeltakZIP_cpp = NULL;
        if (p_difLdeltakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difLdeltakZIP_cpp)(NumericVector,List,List,Nullable<List>,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLdeltakZIP_cpp = (Ptr_difLdeltakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLdeltakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLdeltakZIP_cpp(Shield<SEXP>(Rcpp::wrap(theta)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), 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(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(TCOVinit)), 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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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 double fzkSikt_cpp(NumericVector pi, NumericVector beta, NumericVector nu, NumericMatrix zk, int k, int i, int t, int ng, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, Nullable<IntegerVector> ndeltacum, int period, IntegerVector nbetacum, IntegerVector nnucum) {
        typedef SEXP(*Ptr_fzkSikt_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_fzkSikt_cpp p_fzkSikt_cpp = NULL;
        if (p_fzkSikt_cpp == NULL) {
            validateSignature("double(*fzkSikt_cpp)(NumericVector,NumericVector,NumericVector,NumericMatrix,int,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,Nullable<IntegerVector>,int,IntegerVector,IntegerVector)");
            p_fzkSikt_cpp = (Ptr_fzkSikt_cpp)R_GetCCallable("trajeR", "_trajeR_fzkSikt_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fzkSikt_cpp(Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(t)), 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(ndeltacum)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(nbetacum)), Shield<SEXP>(Rcpp::wrap(nnucum)));
        }
        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 fSikt_cpp(NumericVector pi, NumericVector beta, NumericVector nu, int k, int i, int t, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, Nullable<IntegerVector> ndeltacum, int period, IntegerVector nbetacum, IntegerVector nnucum) {
        typedef SEXP(*Ptr_fSikt_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_fSikt_cpp p_fSikt_cpp = NULL;
        if (p_fSikt_cpp == NULL) {
            validateSignature("double(*fSikt_cpp)(NumericVector,NumericVector,NumericVector,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,Nullable<IntegerVector>,int,IntegerVector,IntegerVector)");
            p_fSikt_cpp = (Ptr_fSikt_cpp)R_GetCCallable("trajeR", "_trajeR_fSikt_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_fSikt_cpp(Shield<SEXP>(Rcpp::wrap(pi)), Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(t)), 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(ndeltacum)), Shield<SEXP>(Rcpp::wrap(period)), Shield<SEXP>(Rcpp::wrap(nbetacum)), Shield<SEXP>(Rcpp::wrap(nnucum)));
        }
        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 QbetakZIP_cpp(NumericVector beta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, Nullable<IntegerVector> ndeltacum) {
        typedef SEXP(*Ptr_QbetakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QbetakZIP_cpp p_QbetakZIP_cpp = NULL;
        if (p_QbetakZIP_cpp == NULL) {
            validateSignature("double(*QbetakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,Nullable<IntegerVector>)");
            p_QbetakZIP_cpp = (Ptr_QbetakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_QbetakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QbetakZIP_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(ndeltacum)));
        }
        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 QnukZIP_cpp(NumericVector nu, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y) {
        typedef SEXP(*Ptr_QnukZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QnukZIP_cpp p_QnukZIP_cpp = NULL;
        if (p_QnukZIP_cpp == NULL) {
            validateSignature("double(*QnukZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix)");
            p_QnukZIP_cpp = (Ptr_QnukZIP_cpp)R_GetCCallable("trajeR", "_trajeR_QnukZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QnukZIP_cpp(Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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)));
        }
        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 QdeltakZIP_cpp(NumericVector delta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, NumericVector beta, int nw) {
        typedef SEXP(*Ptr_QdeltakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QdeltakZIP_cpp p_QdeltakZIP_cpp = NULL;
        if (p_QdeltakZIP_cpp == NULL) {
            validateSignature("double(*QdeltakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,NumericVector,int)");
            p_QdeltakZIP_cpp = (Ptr_QdeltakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_QdeltakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QdeltakZIP_cpp(Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(beta)), 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 QbetadeltakZIP_cpp(NumericVector betadelta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix TCOV, int nw) {
        typedef SEXP(*Ptr_QbetadeltakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_QbetadeltakZIP_cpp p_QbetadeltakZIP_cpp = NULL;
        if (p_QbetadeltakZIP_cpp == NULL) {
            validateSignature("double(*QbetadeltakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,NumericMatrix,int)");
            p_QbetadeltakZIP_cpp = (Ptr_QbetadeltakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_QbetadeltakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_QbetadeltakZIP_cpp(Shield<SEXP>(Rcpp::wrap(betadelta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(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 difQbetakZIP_cpp(NumericVector beta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, Nullable<NumericMatrix> TCOV, Nullable<NumericVector> delta, int nw, Nullable<IntegerVector> ndeltacum) {
        typedef SEXP(*Ptr_difQbetakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQbetakZIP_cpp p_difQbetakZIP_cpp = NULL;
        if (p_difQbetakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difQbetakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,Nullable<NumericVector>,int,Nullable<IntegerVector>)");
            p_difQbetakZIP_cpp = (Ptr_difQbetakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difQbetakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQbetakZIP_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(ndeltacum)));
        }
        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 difQnukZIP_cpp(NumericVector nu, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y) {
        typedef SEXP(*Ptr_difQnukZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQnukZIP_cpp p_difQnukZIP_cpp = NULL;
        if (p_difQnukZIP_cpp == NULL) {
            validateSignature("NumericVector(*difQnukZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix)");
            p_difQnukZIP_cpp = (Ptr_difQnukZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difQnukZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQnukZIP_cpp(Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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)));
        }
        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 difQdeltakZIP_cpp(NumericVector delta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix TCOV, NumericVector beta, int nw) {
        typedef SEXP(*Ptr_difQdeltakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQdeltakZIP_cpp p_difQdeltakZIP_cpp = NULL;
        if (p_difQdeltakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difQdeltakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,NumericMatrix,NumericVector,int)");
            p_difQdeltakZIP_cpp = (Ptr_difQdeltakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difQdeltakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQdeltakZIP_cpp(Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(beta)), 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 difQbetadeltakZIP_cpp(NumericVector betadelta, NumericMatrix zk, NumericMatrix Sikt, int k, int nbeta, int nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix TCOV, int nw) {
        typedef SEXP(*Ptr_difQbetadeltakZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difQbetadeltakZIP_cpp p_difQbetadeltakZIP_cpp = NULL;
        if (p_difQbetadeltakZIP_cpp == NULL) {
            validateSignature("NumericVector(*difQbetadeltakZIP_cpp)(NumericVector,NumericMatrix,NumericMatrix,int,int,int,int,NumericMatrix,NumericMatrix,NumericMatrix,int)");
            p_difQbetadeltakZIP_cpp = (Ptr_difQbetadeltakZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difQbetadeltakZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difQbetadeltakZIP_cpp(Shield<SEXP>(Rcpp::wrap(betadelta)), Shield<SEXP>(Rcpp::wrap(zk)), Shield<SEXP>(Rcpp::wrap(Sikt)), Shield<SEXP>(Rcpp::wrap(k)), 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(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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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(const arma::vec& v, const 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)(const arma::vec&,const arma::vec&)");
            p_convtolist_cpp = (Ptr_convtolist_cpp)R_GetCCallable("trajeR", "_trajeR_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("trajeR", "_trajeR_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 arma::mat extmat_cpp(const arma::mat& m, int i, int j, const List& lng) {
        typedef SEXP(*Ptr_extmat_cpp)(SEXP,SEXP,SEXP,SEXP);
        static Ptr_extmat_cpp p_extmat_cpp = NULL;
        if (p_extmat_cpp == NULL) {
            validateSignature("arma::mat(*extmat_cpp)(const arma::mat&,int,int,const List&)");
            p_extmat_cpp = (Ptr_extmat_cpp)R_GetCCallable("trajeR", "_trajeR_extmat_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_extmat_cpp(Shield<SEXP>(Rcpp::wrap(m)), Shield<SEXP>(Rcpp::wrap(i)), Shield<SEXP>(Rcpp::wrap(j)), 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 mukMult_cpp(const List& ltheta, const arma::mat& mPsi, int i, const arma::vec& vk, const List& lng, const List& lX) {
        typedef SEXP(*Ptr_mukMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_mukMult_cpp p_mukMult_cpp = NULL;
        if (p_mukMult_cpp == NULL) {
            validateSignature("double(*mukMult_cpp)(const List&,const arma::mat&,int,const arma::vec&,const List&,const List&)");
            p_mukMult_cpp = (Ptr_mukMult_cpp)R_GetCCallable("trajeR", "_trajeR_mukMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_mukMult_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)));
        }
        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 piikMult_cpp(const List& ltheta, const arma::mat& mPsi, int i, const arma::vec& vk, const List& lng, const List& lX, const 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)(const List&,const arma::mat&,int,const arma::vec&,const List&,const List&,const arma::mat&)");
            p_piikMult_cpp = (Ptr_piikMult_cpp)R_GetCCallable("trajeR", "_trajeR_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(const List& beta, Nullable<NumericVector> alphainit, int i, int k, const IntegerVector& nbeta, const NumericMatrix& A, const NumericMatrix& Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw, Nullable<List> nuinit, Nullable<IntegerVector> nnuinit, const 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)(const List&,Nullable<NumericVector>,int,int,const IntegerVector&,const NumericMatrix&,const NumericMatrix&,double,double,Nullable<NumericMatrix>,Nullable<List>,int,Nullable<List>,Nullable<IntegerVector>,const std::string&)");
            p_densityChoice_cpp = (Ptr_densityChoice_cpp)R_GetCCallable("trajeR", "_trajeR_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, LogicalVector ssigma) {
        typedef SEXP(*Ptr_likelihoodMult_cpp)(SEXP,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>,LogicalVector)");
            p_likelihoodMult_cpp = (Ptr_likelihoodMult_cpp)R_GetCCallable("trajeR", "_trajeR_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)), 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 NumericVector difLbetavkiLOGIT_cpp(List beta, Nullable<List> delta, int k, int i, int ng, int nx, int n, IntegerVector nbeta, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetavkiLOGIT_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetavkiLOGIT_cpp p_difLbetavkiLOGIT_cpp = NULL;
        if (p_difLbetavkiLOGIT_cpp == NULL) {
            validateSignature("NumericVector(*difLbetavkiLOGIT_cpp)(List,Nullable<List>,int,int,int,int,int,IntegerVector,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetavkiLOGIT_cpp = (Ptr_difLbetavkiLOGIT_cpp)R_GetCCallable("trajeR", "_trajeR_difLbetavkiLOGIT_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetavkiLOGIT_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), 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 arma::vec difLbetavkiZIP_cpp(List beta, List nu, Nullable<List> delta, int k, int i, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLbetavkiZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLbetavkiZIP_cpp p_difLbetavkiZIP_cpp = NULL;
        if (p_difLbetavkiZIP_cpp == NULL) {
            validateSignature("arma::vec(*difLbetavkiZIP_cpp)(List,List,Nullable<List>,int,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLbetavkiZIP_cpp = (Ptr_difLbetavkiZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLbetavkiZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLbetavkiZIP_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), 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<arma::vec >(rcpp_result_gen);
    }

    inline arma::vec difLnuvkiZIP_cpp(List beta, List nu, Nullable<List> delta, int k, int i, int ng, int nx, IntegerVector nbeta, IntegerVector nnu, int n, NumericMatrix A, NumericMatrix Y, NumericMatrix X, Nullable<NumericMatrix> TCOV, int nw) {
        typedef SEXP(*Ptr_difLnuvkiZIP_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difLnuvkiZIP_cpp p_difLnuvkiZIP_cpp = NULL;
        if (p_difLnuvkiZIP_cpp == NULL) {
            validateSignature("arma::vec(*difLnuvkiZIP_cpp)(List,List,Nullable<List>,int,int,int,int,IntegerVector,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,Nullable<NumericMatrix>,int)");
            p_difLnuvkiZIP_cpp = (Ptr_difLnuvkiZIP_cpp)R_GetCCallable("trajeR", "_trajeR_difLnuvkiZIP_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difLnuvkiZIP_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(nu)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), 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<arma::vec >(rcpp_result_gen);
    }

    inline arma::vec difbetavkialpha_cpp(List beta, NumericVector alpha, Nullable<List> delta, int k, int i, 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_difbetavkialpha_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difbetavkialpha_cpp p_difbetavkialpha_cpp = NULL;
        if (p_difbetavkialpha_cpp == NULL) {
            validateSignature("arma::vec(*difbetavkialpha_cpp)(List,NumericVector,Nullable<List>,int,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difbetavkialpha_cpp = (Ptr_difbetavkialpha_cpp)R_GetCCallable("trajeR", "_trajeR_difbetavkialpha_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difbetavkialpha_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), 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<arma::vec >(rcpp_result_gen);
    }

    inline double difalphavki_cpp(List beta, NumericVector alpha, Nullable<List> delta, int k, int i, 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_difalphavki_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difalphavki_cpp p_difalphavki_cpp = NULL;
        if (p_difalphavki_cpp == NULL) {
            validateSignature("double(*difalphavki_cpp)(List,NumericVector,Nullable<List>,int,int,int,int,IntegerVector,int,NumericMatrix,NumericMatrix,NumericMatrix,double,double,Nullable<NumericMatrix>,int)");
            p_difalphavki_cpp = (Ptr_difalphavki_cpp)R_GetCCallable("trajeR", "_trajeR_difalphavki_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difalphavki_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(alpha)), Shield<SEXP>(Rcpp::wrap(delta)), Shield<SEXP>(Rcpp::wrap(k)), Shield<SEXP>(Rcpp::wrap(i)), 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 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, LogicalVector ssigma) {
        typedef SEXP(*Ptr_difLalphaMult_cpp)(SEXP,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>,LogicalVector)");
            p_difLalphaMult_cpp = (Ptr_difLalphaMult_cpp)R_GetCCallable("trajeR", "_trajeR_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)), 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<arma::rowvec >(rcpp_result_gen);
    }

    inline double piikMultV_cpp(arma::vec vthetapsi, int i, arma::vec vk, List lng, List lX, arma::mat mk) {
        typedef SEXP(*Ptr_piikMultV_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_piikMultV_cpp p_piikMultV_cpp = NULL;
        if (p_piikMultV_cpp == NULL) {
            validateSignature("double(*piikMultV_cpp)(arma::vec,int,arma::vec,List,List,arma::mat)");
            p_piikMultV_cpp = (Ptr_piikMultV_cpp)R_GetCCallable("trajeR", "_trajeR_piikMultV_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_piikMultV_cpp(Shield<SEXP>(Rcpp::wrap(vthetapsi)), 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 ThetaPsiPiikMult_cpp(arma::vec vthetapsi, List lng, List lnx, List lnbeta, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List lnw, arma::mat taux, arma::mat mk) {
        typedef SEXP(*Ptr_ThetaPsiPiikMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_ThetaPsiPiikMult_cpp p_ThetaPsiPiikMult_cpp = NULL;
        if (p_ThetaPsiPiikMult_cpp == NULL) {
            validateSignature("double(*ThetaPsiPiikMult_cpp)(arma::vec,List,List,List,List,List,List,List,List,List,Nullable<List>,List,arma::mat,arma::mat)");
            p_ThetaPsiPiikMult_cpp = (Ptr_ThetaPsiPiikMult_cpp)R_GetCCallable("trajeR", "_trajeR_ThetaPsiPiikMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_ThetaPsiPiikMult_cpp(Shield<SEXP>(Rcpp::wrap(vthetapsi)), 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(taux)), 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 arma::vec difThetaPsiPiikMult_cpp(arma::vec vthetapsi, List lng, List lnx, List lnbeta, List ln, List lA, List lY, List lX, List lymin, List lymax, Nullable<List> lTCOVinit, List lnw, arma::mat taux, arma::mat mk) {
        typedef SEXP(*Ptr_difThetaPsiPiikMult_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_difThetaPsiPiikMult_cpp p_difThetaPsiPiikMult_cpp = NULL;
        if (p_difThetaPsiPiikMult_cpp == NULL) {
            validateSignature("arma::vec(*difThetaPsiPiikMult_cpp)(arma::vec,List,List,List,List,List,List,List,List,List,Nullable<List>,List,arma::mat,arma::mat)");
            p_difThetaPsiPiikMult_cpp = (Ptr_difThetaPsiPiikMult_cpp)R_GetCCallable("trajeR", "_trajeR_difThetaPsiPiikMult_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_difThetaPsiPiikMult_cpp(Shield<SEXP>(Rcpp::wrap(vthetapsi)), 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(taux)), 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<arma::vec >(rcpp_result_gen);
    }

    inline double EMdensityChoice_cpp(const List& beta, Nullable<NumericVector> sigmainit, int i, int k, const IntegerVector& nbeta, const NumericMatrix& A, const NumericMatrix& Y, double ymin, double ymax, Nullable<NumericMatrix> TCOV, Nullable<List> delta, int nw, Nullable<List> nuinit, Nullable<IntegerVector> nnuinit, const std::string& model) {
        typedef SEXP(*Ptr_EMdensityChoice_cpp)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP);
        static Ptr_EMdensityChoice_cpp p_EMdensityChoice_cpp = NULL;
        if (p_EMdensityChoice_cpp == NULL) {
            validateSignature("double(*EMdensityChoice_cpp)(const List&,Nullable<NumericVector>,int,int,const IntegerVector&,const NumericMatrix&,const NumericMatrix&,double,double,Nullable<NumericMatrix>,Nullable<List>,int,Nullable<List>,Nullable<IntegerVector>,const std::string&)");
            p_EMdensityChoice_cpp = (Ptr_EMdensityChoice_cpp)R_GetCCallable("trajeR", "_trajeR_EMdensityChoice_cpp");
        }
        RObject rcpp_result_gen;
        {
            RNGScope RCPP_rngScope_gen;
            rcpp_result_gen = p_EMdensityChoice_cpp(Shield<SEXP>(Rcpp::wrap(beta)), Shield<SEXP>(Rcpp::wrap(sigmainit)), 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 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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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("trajeR", "_trajeR_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_trajeR_RCPPEXPORTS_H_GEN_
