GithubHelp home page GithubHelp logo

anhnguyendepocen / fabricatr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from declaredesign/fabricatr

0.0 0.0 0.0 1.25 MB

fabricatr: Imagine Your Data Before You Collect It

Home Page: https://declaredesign.org/r/fabricatr

License: Other

R 100.00%

fabricatr's Introduction

fabricatr: Imagine your data before you collect it

CRAN status CRAN RStudio mirror downloads Build status Code coverage

Making decisions about research design and analysis strategies is often difficult before data is collected, because it is hard to imagine the exact form data will take. Instead, researchers typically modify analysis strategies to fit the data. fabricatr helps researchers imagine what data will look like before they collect it. Researchers can evaluate alternative analysis strategies, find the best one given how the data will look, and precommit before looking at the realized data.

Installing fabricatr

To install the latest stable release of fabricatr, please ensure that you are running version 3.3 or later of R and run the following code:

install.packages("fabricatr")

To install the latest development release of fabricatr, please ensure that you are running version 3.3 or later of R and run the following code:

install.packages("fabricatr", dependencies = TRUE,
                 repos = c("http://r.declaredesign.org", "https://cloud.r-project.org"))

Getting started

Once you have installed fabricatr, you can easily import your own data or generate new data. fabricatr is designed to help you solve two key problems:

  1. Generating variables that look like the real thing, including Likert survey responses, treatment status, demographic variables, and variables correlated by group.
  2. Generating data that are structured like the real thing, including panel data, multi-level (“nested”) data or cross-classified data.

fabricatr is easy to learn and easy to read. Consider this example which generates data modeling the United States House of Representatives:

set.seed(1)
library(fabricatr)

house_members <- fabricate(
  party_id = add_level(
    N = 2, party_names = c("Republican", "Democrat"), party_ideology = c(0.5, -0.5),
    in_power = c(1, 0), party_incumbents = c(241, 194)
  ),
  rep_id = add_level(
    N = party_incumbents, member_ideology = rnorm(N, party_ideology, sd = 0.5),
    terms_served = draw_count(N = N, mean = 4),
    female = draw_binary(N = N, prob = 0.198)
  )
)
party_names party_ideology in_power member_ideology terms_served female
Republican 0.5 1 0.43 3 0
Republican 0.5 1 -0.19 1 0
Republican 0.5 1 0.52 4 0
Republican 0.5 1 0.85 2 0
Republican 0.5 1 0.59 5 0

Next Steps

For more information, read our online tutorial to get started with fabricatr. This tutorial will give you a brief overview of fabricatr’s main functions and direct you towards your next steps. You can also read our documentation inside R using the command ?fabricate as your entry point.

This project is generously supported by a grant from the Laura and John Arnold Foundation and seed funding from EGAP.

fabricatr's People

Contributors

aaronrudkin avatar acoppock avatar graemeblair avatar lilymedina avatar nfultz avatar nick-rivera 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.