GithubHelp home page GithubHelp logo

vishalbelsare / r-flame Goto Github PK

View Code? Open in Web Editor NEW

This project forked from almost-matching-exactly/r-flame

0.0 0.0 0.0 15.05 MB

R Implementation of FLAME and other algorithms in the AME framework

License: Other

R 80.25% TeX 0.81% HTML 14.31% CSS 4.64%

r-flame's Introduction

Build Status

Introduction

The FLAME package offers efficient implementations of the Fast, Large-Scale, Almost Matching Exactly (FLAME) and Dynamic Almost Matching Exactly (DAME) algorithms, described in detail here and here, respectively. Both algorithms are interpretable matching methods for performing causal inference on observational data with discrete covariates. The algorithms work by matching units that share identical values of certain covariates; machine learning on a holdout set is used to learn which covariates are more important for predicting the outcome and prioritize matches on those covariates. FLAME provides easy summarization, analysis, and visualization of treatment effect estimates, and features a wide variety of options for how matching is to be performed, allowing for users to make analysis-specific decisions throughout the matching procedure. In the future, the package will be updated to include other algorithms in the Almost Matching Exactly framework, such as a database implementation of FLAME / DAME (allowing for inference on data too large to fit in memory), FLAME-Networks (allowing for inference on data subject to network interference), AHB (allowing for inference on mixed discrete and continuous data), MALTS (allowing for inference on mixed discrete and continuous data), and FLAME-IV (allowing for inference with instrumental variables).

An Example

We start by generating some toy data for matching by using the gen_data function included in the package:

matching_data <- gen_data(n = 500, p = 5)
holdout_data <- gen_data(n = 500, p = 5)

We can then match the units in matching_data, by calling the FLAME function, which matches units according to the FLAME algorithm. The supplied holdout_data is used to learn a weighted Hamming distance between units that determines what covariates are more important and therefore what matches should be made.

FLAME_out <- FLAME(matching_data, holdout_data)

The output of a call to FLAME is of class ame and the package includes print, summary, and plot methods to give information on average treatment effect estimates, matched groups formed, and covariates matched on.

Using DAME for matching is analogous and can be done using the DAME function.

For a more in-depth discussion of the package that covers missing data handling, machine learning on the holdout set, matching with replacement, and more, please see the accompanying vignette.

Installation

FLAME can be installed directly from CRAN via running install.packages('FLAME') in R. This will also install gmp for FLAME's efficient bit-vectors implementation and glmnet for outcome prediction.

Alternatively, you can install the development version of the package from the author's GitHub, here via devtools::install_github('https://github.com/vittorioorlandi/FLAME') or the Almost Matching Exactly GitHub here via devtools::install_github('https://github.com/almost-matching-exactly/R-FLAME') (the latter is a mirror of the former).

r-flame's People

Contributors

vittorioorlandi avatar thowell332 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.