Coder Social home page Coder Social logo

ctsdoseresponse's Introduction

ctsDoseResponse

Overview

ctsDoseResponse is a tool for nonparametric estimation and inference of a continuous dose-response curve, as well as for null hypothesis testing of whether a dose-response is flat or not. It has two main functions ctsCausal and ctsCausalTest.

The function for nonparametric estimation and inference, ctsCausal, is implemented with three different methods. The method dr.isoreg is for causal isotonic regression, the method dr.loclin is for doubly robust estimation of continuous treatment effects and the method dr.debiased is for debiased doubly robust estimation of continuous treatment effects.

ctsCausalTest has two different methods for null hypothesis testing. dr.nd is for nonparametric tests of causal null with nondiscrete exposures and dr.cts is for nonparametric doubly robust test for a continuous treatment effect.

Installation

Please use the R command devtools::install_github("https://github.com/Yujian-Wu/ctsDoseResponse/tree/main", dependencies = T) to install the package and dependent packages. You might be prompted to updated some existing packages. If you wish to update the package RcppArmadillo and the version of your R is not most updated, please be advised to install it from sources that the package does NOT need compilation.

Example

library(ctsDoseResponse)

set.seed(12345)

n <- 200
cols <- 3

W <- matrix(runif(n*cols), ncol = cols) # a 200 * 3 matrix of covariates
A <- rnorm(n, mean=W%*%rnorm(cols)) # a 200 * 1 vector of treatment variable
Y <- rnorm(n, mean = a^2 + rnorm(n)) # a 200 * 1 vector of response variable

### causal isotonic regression
iso.reg <- ctsCausal(Y, A, W, method='dr.isoreg', cross.fit = F)

### continuous dose-response curve with smoothing treatment
loc.lin <- ctsCausal(Y, A, W, method='dr.loclin')

### debiased continuous dose-response curve with smoothing treatment
bc.loc.lin <- ctsCausal(Y, A, W, method='dr.debiased')

### null hypothesis test for non-diescrete treatment
test.nd <- ctsCausalTest(Y, A, W, method='dr.nd')

### null hypothesis test for continuous treatment
test.cts <- ctsCausalTest(Y, A, W, method='dr.cts')

ctsdoseresponse's People

Contributors

yujian-wu avatar

Stargazers

 avatar Kenta Takatsu avatar

Watchers

 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.