GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - TraME-Project/TraME-Rcpp: TraME Library using Rcpp modules

BranchesTags
Open more actions menu

Latest commit

 

History

754 Commits
754 Commits

Folders and files

NameName
Last commit message
Last commit date
R
R
 
 
examples
examples
 
 
man
man
 
 
src
src
 
 
.Rbuildignore
.Rbuildignore
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
DESCRIPTION
DESCRIPTION
 
 
LICENSE
LICENSE
 
 
NAMESPACE
NAMESPACE
 
 
README.md
README.md
 
 
appveyor.yml
appveyor.yml
 
 
configure
configure
 
 
configure.win
configure.win
 
 

Repository files navigation

TraME-Rcpp   Build Status Build status

Transportation Methods for Econometrics via Rcpp modules

Overview

TraME (Transportation Methods for Econometrics) is a C++ library for solving problems of equilibrium computation and estimation in consumer demand and matching frameworks via the Mass Transportation Approach.

TraME-Rcpp is a package of Rcpp modules that allows seamless integration of the TraME C++ library with R.

Installation and Testing

The quickest way to install TraME-Rcpp is via the devtools package.

install.packages("devtools")
library(devtools)
install_github("TraME-Project/TraME-Rcpp")

The TraME test routines are invoked as follows:

library(TraME.Rcpp)
tests_TraME()

Note that TraME requires compilation, and so an appropriate development environment is necessary to install the package.

  • Windows users should get Rtools.
  • Mac uses should check here.

Example

The following code replicates the example from here.

rm(list=ls())
library(TraME.Rcpp)

#

nbX = 18   # number of x types
nbY = 5    # number of y types
sigma = 1  # scaling value

n = rep(1,nbX)  # number of agents of each type
m = rep(1,nbY)

# systematic utilities

alpha = matrix(runif(nbX*nbY),nbX,nbY)
gamma = matrix(runif(nbX*nbY),nbX,nbY)

lambda = 1 + matrix(runif(nbX*nbY),nbX,nbY)
zeta = 1 + matrix(runif(nbX*nbY),nbX,nbY)

phi = alpha + gamma

lambda_LTU = lambda/(lambda + zeta)
phi_LTU = (lambda*alpha + zeta*gamma) / (lambda + zeta)

# build markets

mfe_geo_obj <- new(mfe_geo) # geometric matching function <=> perfectly transferable utility
mfe_geo_obj$build(n,m,phi,sigma,FALSE)

mfe_cd_obj <- new(mfe_cd)   # CD matching function <=> linearly transferable utility
mfe_cd_obj$build(n,m,lambda_LTU,phi_LTU,sigma,FALSE)

mfe_min_obj <- new(mfe_min) # min matching function <=> non-transferable utility
mfe_min_obj$build(n,m,alpha,gamma,sigma,FALSE)

# run IPFP

ptm = proc.time()

sol_geo <- mfe_geo_obj$solve("ipfp")
sol_cd <- mfe_cd_obj$solve("ipfp")
sol_min <- mfe_min_obj$solve("ipfp")

time =  proc.time()  - ptm

message(paste0('\nTime taken = ', time["elapsed"], 's.\n'))

sol_cd <- mfe_cd_obj$solve("ipfp",1E-04,1000) # direct control over tolerance values

Authors

Alfred Galichon and Keith O'Hara

License

GPL (>= 2)

Acknowledgements

Work on TraME is supported by NSF Grant DMS-1716489

About

TraME Library using Rcpp modules

Resources

Readme
GPL-2.0 license
Activity
Custom properties

Stars

8 stars

Watchers

3 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.