Skip to content
/ iptw Public
forked from ehsanx/iptw

This R package calculates various measures of association and helps understand and visualize the link between causal models such as Marginal Structural Models and Standerdized measures.

License

Notifications You must be signed in to change notification settings

guhjy/iptw

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iptw

R package for calculating Inverse Probability of Treatment Weights

  • This package calculates various measures of association and helps understand and visualize the link between causal models such as Marginal Structural Models and Standerdized measures.

Installation

library(devtools)
install_github("ehsanx/iptw")

Loading the package

require(iptw)

Pulling the help file

help(package="iptw")

Using this package

r1 <- .9 # Risk of the treated subjects
r0 <- .5 # Risk of the untreated subjects
measures.calc(r1,r0)
# Calculates risk measures

form.table.object <- form.table(Y1A1L1=150, 
                                Y1A0L1=45, 
                                Y1A1L0=20, 
                                Y1A0L0=5, 
                                Y0A1L1=300, 
                                Y0A0L1=10, 
                                Y0A1L0=40, 
                                Y0A0L0=55)
form.table.object
# Forms the crude, stratified tables suitable 
# for using in other functions of this package.

ungrouped.data.object <- ungrouped.data(form.table.object)
# Creates ungrouped data suitable for performing regression on it
head(ungrouped.data.object)

associational(form.table.object) 
# Calculates measures of associations
standardization(form.table.object) 
# Calculates Standardized measures
iptw(form.table.object, type = "sw") 
# Standardized measures are calculated by this function 
# using inverse probability of treatment weights (IPTW).

iptw.regression(form.table.object, type = "sw") 
# Calculates IPTW estimates from regression
# requires grid and survey package

graph(form.table.object, type = "sw")
# Maps probabilities and frequesncies

Author

  • Ehsan Karim :octocat: Feel free to report any errors / update suggestions.

Useful Reference

  • Hernán MA, Robins JM (2016). Causal Inference. Boca Raton: Chapman & Hall/CRC, forthcoming.

Related web-Apps

About

This R package calculates various measures of association and helps understand and visualize the link between causal models such as Marginal Structural Models and Standerdized measures.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%