Giter Site home page Giter Site logo

mpcmp's Introduction

Hi there ๐Ÿ‘‹

My name is Thomas and welcome to my Github page!

  • ๐Ÿ’ฌ I can speak English, Cantonese and R fluently.
  • ๐Ÿ”ญ Iโ€™m currently working on various projects in modelling count/integer-valued data. Please dm me if you would like to collaborate.
  • โšก Fun fact: I like baking and I often bake late at night. I also like a good cup of coffee. โ˜•๏ธ
  • ๐Ÿ“ซ How to reach me: For my github repos, filing an an issue in the corresponding github repo. For others, email [email protected]

mpcmp's People

Contributors

ayaalwan avatar jrwishart avatar thomas-fung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ayaalwan

mpcmp's Issues

documentation for nu estimation

Hi Thomas,

In the documentation for glm.cmp, the formulation for the varying dispersion model is given by

Y_i ~ CMP(mu_i, nu_i)

where

E(Y_i) = mu_i = exp(x_i^T beta),

and dispersion parameters are model via

nu_i = exp(s_i^T gamma)

This might not warrant an issue (sorry!!), but in the formulation for for nu_i, what is s_i referring to?

Thank you,

Sean

Error when using gammastart

This issue was submitted us by Sijie Wang.

library(mpcmp)
data(sitophilus)
M.sit <- glm.cmp(formula = ninsect ~ extract,
                 formula_nu = ~extract, 
                 data = sitophilus)
glm.cmp(formula = ninsect ~ extract,
        formula_nu = ~extract, 
        data = sitophilus, 
        gammastart = M.sit$coefficients_gamma)
#> Error in comp_lambdas(mu0, nu0, lambdalb = lambdalb, lambdaub = min(lambdaub, : object 'lambdaold' not found

Created on 2022-05-10 by the reprex package (v2.0.1)

CRAN check issues

Received a message from Prof Ripley that CRAN checks picked up a couple of errors on the devel version on Linux and windows. For some unknown reason, it's rounded one of the coefficients to a different number.

Screen Shot 2022-05-11 at 10 10 28 am

Post hocs

Hi!
First of all, this is a fantastic package! I am a biologist who deals with count data that often is not equidispersed. CMP regression using mpcmp models my data very well. The only thing that would be great to have for me and I guess other users is possibility to do posthoc or contrast comparisons. I am wondering maybe this is in your plans, or do you have a dirty script to do that/ make cmp objects communicate with emmeans or other established R packages?

I can't generate random number from COM-POISSON distribution if mean is large

I know that mpcmp::dcomp() generates random numbers from COM-Poisson distribution. However, they fail to generate such data if mean is large.

The following example doesn't compute, or takes too much time:

mpcmp::rcomp(1, mu = 500, nu = 1)

How can I generate a COM-Poisson data with large mean efficiently?

offset terms in glm.cmp?

Hi Thomas,

Thanks for putting together such a helpful package. I'm interested in including an offset term in my glm.cmp model, but it doesn't seem to get carried through to the final output. For example,

set.seed(1)

#generate variable to use as an offset
cottonbolls$n_samples <- rpois(nrow(cottonbolls), 5)

#fit with offset
M.bolls <- glm.cmp(nc~ 1+stages:def+stages:def2, offset = log(n_samples),data = cottonbolls)
M.bolls$offset

returns a vector of zeros. Is this the correct method to incorporate an offset term into glm.cmp models, or am I going about it wrong?

Best

Sean

glm.cmp would give an error if the model matrix doesn't have full rank

library(tidyverse)
library(mpcmp)
dat <- tribble(~count, ~ code1, ~code2,
               3, "Code 1", "Code 1",
               4, "Code 2", "Code 1",
               2, "Code 2", "Code 1",
               5, "Code 2", "Code 2",
               1, "Code 2", "Code 2")
M1 <- glm(formula=count ~ code1 * code2, data = dat, family = poisson)
coef(M1)
#>             (Intercept)             code1Code 2             code2Code 2 
#>            1.098612e+00           -2.167798e-16            5.768888e-16 
#> code1Code 2:code2Code 2 
#>                      NA
M2 <- glm.cmp(formula=count ~ code1 * code2, data = dat)
#> Error in if (update_info_matrix < 0) {: missing value where TRUE/FALSE needed

Created on 2020-10-30 by the reprex package (v0.3.0)

Need to update the main fitting function to make it behave more like the glm function.

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.