Giter Club home page Giter Club logo

Comments (4)

sstats2024 avatar sstats2024 commented on July 18, 2024 1

Thanks @danielinteractive. I've included the output above. Even after installing the latest version of mmrm, I'm still getting the same output as before.

from mmrm.

danielinteractive avatar danielinteractive commented on July 18, 2024

Thanks @sstats2024 , can you please include the output you get?

from mmrm.

danielinteractive avatar danielinteractive commented on July 18, 2024

Also please try to install the latest CRAN release and see if the problem persists

from mmrm.

danielinteractive avatar danielinteractive commented on July 18, 2024

Hi again @sstats2024 ,

so I ran this on my Macbook, and also get slightly different coefficient estimates each time:

> coef(mmrmfit1)
 eye_visitleft_Week0  eye_visitleft_Week4  eye_visitleft_Week8 eye_visitright_Week0 
          27.2299828           29.2062931           35.7662590           26.6797737 
eye_visitright_Week4 eye_visitright_Week8                  age 
          33.3781034           36.9494047           -0.3037041 
> coef(mmrmfit2)
                 age  eye_visitleft_Week0  eye_visitleft_Week4  eye_visitleft_Week8 
          -0.3037215           27.2307519           29.2070622           35.7670281 
eye_visitright_Week0 eye_visitright_Week4 eye_visitright_Week8 
          26.6805428           33.3788725           36.9501738 
> c1 <- coef(mmrmfit1)
> c2 <- coef(mmrmfit2)
> setequal(names(c1), names(c2))
[1] TRUE
> c1 - c2[names(c1)]
 eye_visitleft_Week0  eye_visitleft_Week4  eye_visitleft_Week8 eye_visitright_Week0 
       -7.691045e-04        -7.691045e-04        -7.691045e-04        -7.691045e-04 
eye_visitright_Week4 eye_visitright_Week8                  age 
       -7.691045e-04        -7.691045e-04         1.736128e-05 
> diff_coefs <- c1 - c2[names(c1)]
> diff_coefs
 eye_visitleft_Week0  eye_visitleft_Week4  eye_visitleft_Week8 eye_visitright_Week0 
       -7.691045e-04        -7.691045e-04        -7.691045e-04        -7.691045e-04 
eye_visitright_Week4 eye_visitright_Week8                  age 
       -7.691045e-04        -7.691045e-04         1.736128e-05 
> rel_diff_coefs <- abs(diff_coefs / c1)
> rel_diff_coefs
 eye_visitleft_Week0  eye_visitleft_Week4  eye_visitleft_Week8 eye_visitright_Week0 
        2.824477e-05         2.633352e-05         2.150363e-05         2.882725e-05 
eye_visitright_Week4 eye_visitright_Week8                  age 
        2.304219e-05         2.081507e-05         5.716510e-05 
> all(rel_diff_coefs < 1e-3)
[1] TRUE

However, this is completely fine, as both the absolute differences as well as the relative differences are very small. Since we use floating point calculations in the computer, the ordering of the design matrix columns, induced here by the ordering of the covariates in the formula, will slightly influence the results. But these differences don't matter in practice.

You will also see a similar behavior with other modeling packages or methodologies.

If you would like to avoid this, you would have to sort the covariates yourself before putting them in the formula e.g.

Does this solve your question?

from mmrm.

Related Issues (20)

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.