Giter VIP home page Giter VIP logo

countr's Introduction

CRANStatusBadge R-CMD-check

Installing Countr

The latest stable version is on CRAN.

install.packages("Countr")

You can install the development version of Countr from Github:

library(devtools)
install_github("GeoBosh/Countr")

Overview

Flexible univariate count models based on renewal processes. The models may include covariates and can be specified with familiar formula syntax as in glm() and package 'flexsurv'. The methodology is described in a forthcoming paper in the Journal of Statistical Software. The paper is included as vignette vignette("Countr_guide") along wth several additional vignettes containing worked examples and additional details, see Countr CRAN page.

The package is developed by Tarak Kharrat and Georgi N.Boshnakov.

countr's People

Contributors

geobosh avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

nikh123

countr's Issues

object 'xtimes' not found

This error appears on Windows since the release of optimx version 2018-7.10. The issue was raised on Stackoverflow, see https://stackoverflow.com/questions/52927399/renewalcount-function-in-countr.

A workaround for users is to do xtimes <- 1 before calling renewalCount(). Another, more drastic, option is to go back to the previous release of optmix.

I am opening the issue here for easy reference. The example below is from the Stackoverflow link above (I prepended an option() command for debugging).

options(error = recover)
library("Countr")
library("dplyr")
library("xtable")
D=matrix(c(1:9))
Numb=matrix(c(15, 4, 5, 3, 1, 2, 1, 1, 1))
Number=data.frame(Numb)
a_weib <- renewalCount(formula = D ~ 1, data = Number, dist = "weibull", 
     computeHessian = FALSE,  control = renewal.control(trace = 0))

Running the above code (under Windows) gives:

Error in order(-value, xtimes) : object 'xtimes' not found

xtimes is documented to be part of the result of 'optimx' and fitCount_ is the object returned by optimx(). Printing it gives:

Browse[2]> fitCount_
         scale_     shape_     value fevals gevals niter convcode kkt1 kkt2
nlminb 1.343784 -0.2194413 -21.21925     12     21     9        0   NA   NA
       xtime
nlminb  0.34

We see that there is a column xtime, not xtimes. Indeed,

Browse[3]> names(fitCount_)
 [1] "scale_"   "shape_"   "value"    "fevals"   "gevals"   "niter"   
 [7] "convcode" "kkt1"     "kkt2"     "xtime"   

The problem may be ocuring in optimx:::optimx.run(). It assigns ans$xtimes <- time on line 736 of optimx.run.R but later assembles another object from ans and other stuff, without explicitly mentioning column names.

The line of code in Countr where the error occurs needs to be replaced in any case by a more robust version.

offset parameter in renewalCount function

I have a database and I would like to use the gamma and weibull distribution to model the number of events that occurred during different time intervals.

I have found the countr package to meet my requirements perfectly. I made two scenarios, in the first one I model the number of events according to some covariates without using the offset parameter. In the second scenario I used the offset parameter. Comparing summary of the two scenarios, the result is identical. This result does not match my expectations and I do not know why?

Regarding the Countr package, I would like to know if the offset parameter is implemented in the renewalCount function ?

I am a new user of rstudio.

Thanks

missing value where TRUE / FALSE needed

I don't have any NA in my data but I have this error and I don't understand the meaning

Error in if (var < 0) { : missing value where TRUE / FALSE needed
De plus : Warning message:
In .checkInitialValues(dist, start, modelMatrixList, weights, Y, :
unnamed initial values found! They will be used as they are.

Thanks

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.