Giter Site home page Giter Site logo

plmed's Introduction

plmed

R-package for partially linear mediation

To install:

devtools::install_github("ohines/plmed")
library(plmed)

To see documentation

?plmed
?G_estimation
?TTS

To uninstall:

remove.packages(plmed)

plmed's People

Contributors

ohines avatar

Stargazers

Student Hu avatar

Watchers

 avatar

plmed's Issues

Does IF.glm() work for any family and link (especially non-canonical link)?

IF.glm <- function(object,x=object$x){ 
  NROW(object$y)*(x*object$prior.weights*(object$y-object$fitted.values))%*%chol2inv(object$qr$qr)
}

The chol2inv(object$qr$qr) seems magic, can you elaborate, please? Thank you!

Under the canonical link, the estimating equation is x{y-mu(x^t b)}, hence the influence function (by the argument of Z-estimation) is [E{mu'(x^t b) x x^t}]^-1 {y-mu(x^t b)}x. My naive implementation is this:

glm_IF <- function(glm_obj) {
  # assume glm_obj fitted with x = True
  (glm_obj$x * glm_obj$prior.weights * (glm_obj$y - glm_obj$fitted.values)) %*%
    solve(crossprod(glm_obj$family$mu.eta(glm_obj$linear.predictors) * glm_obj$x, glm_obj$x) / NROW(glm_obj$y))
}

By the way, I just happened to google with "glm influence function" and your repo pops up. I'm also dealing with some two-step estimation which requires the first-step influence function. I thought it would be convenient to use the glm object.

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.