Skip to main content

A simple library for estimating the impact of an intervention, with humility

Project description

Estimate the impact of an intervention, with simplicity and humility

Pre/Posterous is under active development and the current release can be considered a ‘proof of concept’. The largest restriction is that it only imports data from the Reporter app, which is my current default recommendation for anyone who is trying to track something for Quantified Self.

Installation

You can install with pip install preposterous

If you want to install from source, then clone this repository and run pip install -e . from the project root.

Testing

Tests can be seen in the tests/ directory and run with pytest

Use cases

Quantified Self data

The primary use case is for quantified self, where you have periodic measurements of the target metric (weight, categorical sleep quality, ect) and potential interventions (medications, diet shifts, ect). This library can organize these into ‘natural experiments’ that point the way towards a causal relationship

Warning Python is pretty great, but nothing can replace a well powered Double Blind Randomized Controlled Trial for establishing causality. That said, many (most?) situations do not lend themselves to RCTs, and yet we’re still forced to make decisions. That’s where tools like this, used with an appreciation for non-binary modes of belief, can be helpful.

Example

import preposterous.preposterous as ppl
pdf = ppl.PrePostDF()
pdf.add_outcome(filename='data/sample_reporter_output.csv')
pdf.add_intervention(filename='data/sample_reporter_output.csv')

# Sanity check the data
pdf.basic_info()

# Basic statistical test of difference between periods pre and post intervention
pdf.fisher_test(intervention='Exercise')

# Bayesian comparison of relative impact of multiple interventions
# (note that the sample data only contains one)
# Output is written to an image file named 'relative_effectiveness_YYYYMMDD.png'
pdf.outcomes(
    positive_outcomes=['Totally fine'],
    negative_outcomes=['Noticeable', 'Distracting'],
    window=3
)
pdf.calculate_relative_effectiveness()
_ = pdf.plot_relative_effectiveness()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

preposterous-0.0.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

preposterous-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file preposterous-0.0.2.tar.gz.

File metadata

  • Download URL: preposterous-0.0.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.14

File hashes

Hashes for preposterous-0.0.2.tar.gz
Algorithm Hash digest
SHA256 729e745b62194f21605f4e77d370ce5ecd9305b5169dc759f12b21f77e128ee9
MD5 88cf78e4667dfde04aaa5809fa395a5c
BLAKE2b-256 c672237409314766a688c4f3cdf754dc247a2583aa82b667320322017307117a

See more details on using hashes here.

File details

Details for the file preposterous-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: preposterous-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.14

File hashes

Hashes for preposterous-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d3e4a32de196d332165eab61d90ef5d4fd34990d2456c2f23ebe71b2a81f9bb
MD5 2614963b93935e8e6263fef6436e6329
BLAKE2b-256 4c55fd756ae07bb75828d165df4f9f26f90439563588a07baace232809f06f34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page