Coder Social home page Coder Social logo

lmmstar's Introduction

Build status Build status License

LMMstar: Repeated Measurement Models for Discrete Times

LMMstar stands for Linear Mixed Models - statistical analysis in R. It is companion R package for the course “Statistical analysis of correlated and repeated measurements for health science researchers” taught by the section of Biostatistics of the University of Copenhagen. It provides functions for computing summary statistics and obtaining graphical displays of longitudinal data, as well as for statistical modeling and statistical inference using mixed models. In particular, it implements linear mixed models where the model for the variance-covariance of the residuals is specified via patterns (compound symmetry, toeplitz, unstructured, …), possibly stratified on a categorical variable. Statistical uncertainty for mean, variance, and correlation parameters is performed based on the observed information. Statistical testing can be performed for arbitrary linear or non-linear combination(s) of model coefficients. For linear combinations, a Satterthwaite approximation of the degrees of freedom is available. Normalized residuals are provided to assess model misspecification. Predictions can be computed conditional to covariates only or also to outcome values.

This package builds on existing software:

  • lava for simulating data
  • multcomp for adjusting for multiple comparisons
  • ggplot2 for graphical displays

Installation

You can download the latest stable version on CRAN using:

install.packages("LMMstar")

or download the development version from GitHub:

library(remotes)
install_github("bozenne/LMMstar")

For the later you will need a fairly recent R version (>=4.0.0) and, for windows users, Rtools. You can check both using:

paste0(R.Version()[c("major","minor")], collapse = ".")
pkgbuild::find_rtools()
[1] "4.1.1"
[1] TRUE

Export citation

citation("LMMstar")
To cite the 'LMMstar' package in publications use the following text:

  Ozenne B, Forman J (2024). _LMMstar: Repeated measurement models for
  discrete times_. R package version 1.1.0.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {LMMstar: Repeated measurement models for discrete times},
    author = {Brice Ozenne and Julie Forman},
    year = {2024},
    note = {R package version 1.1.0},
  }

Functionalities

For an overview of the package see the following vignette ./vignettes/overview.pdf.

For an introduction to partial residual see this other vignette ./vignettes/partial-residuals.pdf

lmmstar's People

Contributors

bozenne avatar karlbangchristensen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lmmstar's Issues

Problem with `as.data.frame` with `emmGrid` objects

Hello,

I ran into a snag with the LMMstar package with my latest update. In emmeans version 1.8.0, I had changed as.data.frame() to return an object of class summary_emm, so that the annotations still are visible. I did this because I get a lot of questions from people who used as.data.frame and then didn't see the messages that would have cleared up their question had they seen them. A summary_emm object is still a data frame, so that shouldn't cause problems. -- And it didn't until my latest update.

What happened with my latest update is that I also changed the way the [ operator works so that we retain the summary_emm class whenever possible. The snag is in your method dummy.coef.lmm, in which the object out (which is the returned object) is now a summary_emm object. You change the names of all the columns and also change attr(out, "estName") to NULL. That creates a problem because when out is returned and displayed, it goes through print.summary_emm which requires that attribute to be present.

I'm going to try to robustify my package code so it can get past that; but my suggestion is that in your next update, you return data.frame(out). Doing so also nulls-out all those attributes that you manually nulled-out in your code.

Error when installing LMMstar - gsl dependency

The LMMstar package currently depends on the copula package which itself depends on the gsl package.
This can be problematic as there is a system requirement (e.g. Gnu Scientific Library version >= 2.5) that if not satisfied will lead to an error when running install.package("LMMstar").
The issue has already been raised on Linux machines (for another package) and a possible solution is to run in a terminal
sudo add-apt-repository ppa:dns/gnu
sudo apt-get update
sudo apt install libgsl-dev
See https://stackoverflow.com/questions/69583193/installing-r-gsl-package-on-ubuntu for details.

Issue running lmm function

I have tried to run the example in the lmm function documentation:

simulate data in the long format

set.seed(10)
dL <- sampleRem(100, n.times = 3, format = "long")

fit Linear Mixed Model

eCS.lmm <- lmm(Y ~ X1 + X2 + X5, repetition = ~visit|id, structure = "CS", data = dL)

But when fitting the lmm model, the following error arises:

Error in [[<-.data.frame(*tmp*, iVar, value = integer(0)) :
replacement has 0 rows, data has 300

Can you please advise?

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.