Giter VIP home page Giter VIP logo

spduration's Introduction

spduration

R-CMD-check CRAN version Codecov test coverage

spduration implements a split-population duration model for duration data with time-varying covariates where a significant subset of the population or spells will not experience failure.

library("spduration")
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
# Prepare data
data(coups)
dur.coups <- add_duration(coups, "succ.coup", unitID="gwcode", tID="year",
                          freq="year")

# Estimate model
model.coups <- spdur(duration ~ polity2, atrisk ~ polity2, data = dur.coups,
                     silent = TRUE)
summary(model.coups)
## Call:
## spdur(duration = duration ~ polity2, atrisk = atrisk ~ polity2, 
##     data = dur.coups, silent = TRUE)
## 
## Duration equation: 
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.00150    0.23762  16.840  < 2e-16 ***
## polity2      0.20588    0.03037   6.779 1.21e-11 ***
## 
## Risk equation: 
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   6.5278     3.2556   2.005   0.0449 *
## polity2       0.8966     0.4084   2.196   0.0281 *
## 
##            Estimate Std. Error t value Pr(>|t|)
## log(alpha) -0.03204    0.11899  -0.269    0.788
## ---
## Signif. codes: *** = 0.001, ** = 0.01, * = 0.05, . = 0.1
plot(model.coups, type = "hazard")

Install

  • the latest released version from CRAN:
install.packages("spduration")
  • the latest development version:
library(devtools)
install_github("andybega/spduration")

Contact

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.