Additive Random Utility Models (ARUMs)


 

None Class


Class Definition

Definition:

 
class none
{
    public:
        // build objects
        int nbX;
        int nbY;
        int nbParams;
        
        // input objects
        arma::mat mu;
        arma::mat U;
        
        // equilibrium objects
        arma::mat mu_sol;
        arma::mat U_sol;
        
        // member functions
        ~none(){};
         none(){};
        explicit none(int nbX_inp, int nbY_inp);
        
        void build(int nbX_inp, int nbY_inp);
        
        double G(const arma::vec& n);
        double G(const arma::vec& n, const arma::mat& U_inp, arma::mat& mu_out);
        double Gx(const arma::mat& U_x_inp, arma::mat& mu_x_out);
        double Gx(const arma::mat& U_x_inp, arma::mat& mu_x_out, int x);

        double Gstar(const arma::vec& n);
        double Gstar(const arma::vec& n, const arma::mat& mu_inp, arma::mat& U_out);
        double Gstarx(const arma::mat& mu_x_inp, arma::mat &U_x_out, int x);
        
        double Gbar(const arma::mat& Ubar, const arma::mat& mubar, const arma::vec& n, arma::mat& U_out, arma::mat& mu_out);
        double Gbarx(const arma::vec& Ubar_x, const arma::vec& mubar_x, arma::mat& U_x_out, arma::mat& mu_x_out);
        double Gbarx(const arma::vec& Ubar_x, const arma::vec& mubar_x, arma::mat& U_x_out, arma::mat& mu_x_out, int x);
        
        arma::vec dtheta_NablaGstar();
        
        empirical simul();
        empirical simul(int* nbDraws, int* seed);
        void simul(empirical& obj_out);
        void simul(empirical& obj_out, int* nbDraws, int* seed);
};

Member Objects


Member Functions


Notes


Examples

Example:

 
    //
    // inputs:
    arma::mat U(2,3);
    U  << 1.6 << 3.2 << 1.1 << arma::endr
       << 2.9 << 1.0 << 3.1 << arma::endr;
    
    arma::mat mu(2,3);
    mu << 1.0 << 3.0 << 1.0 << arma::endr
       << 2.0 << 1.0 << 3.0 << arma::endr;
    //
    // setup none class object
    int nbX = U.n_rows;
    int nbY = U.n_cols;
    
    arma::vec n = arma::sum(mu,1);
    //
    trame::none none_obj(nbX,nbY);
    
    none_obj.U = U;
    none_obj.mu = mu;
    //
    double val_G = none_obj.G(n);
    std::cout << "G val: \n" << val_G << std::endl;
    //
    arma::mat mubar(2,3);
    mubar.fill(2);

    arma::mat Ubar_temp, mubar_temp;
    double valGbar = none_obj.Gbar(U,mubar,n,Ubar_temp,mubar_temp);
    
    std::cout << "Gbar val: \n" << valGbar << std::endl;