Giter VIP home page Giter VIP logo

rlrsim's People

Contributors

bbolker avatar fabian-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rlrsim's Issues

No support for models of class "lm" so cannot compare "lmer" to "lm"

I cannot work out how to use exactRLRT to test a case with a single random effect. This is because lme4 will not let me create a model with no random effects and RLRsim does not support models of class lm.

set.seed(123)
group_intercepts <-
  tibble(
    group_id = 1:10,
    group_effect = rnorm(10)
  )

random_data <- 
  tibble(
    group_id = rep(1:10, each = 10),
    x = rnorm(100)
  ) |>
  inner_join(group_intercepts, by = "group_id") |>
  mutate(
    y = 2 * x + group_effect + rnorm(100) / 2
  )

m_full <- lmer(y ~ x - 1 + (1 | group_id), data = random_data)  
summary(m_full)

m_restricted <- lm(y ~ x - 1, data = random_data)
summary(m_restricted)

exactRLRT(m = m_full, m0 = m_restricted)

exactRLRT(m = m_full, mA = m_full, m0 = m_restricted)

The last 2 lines are me trying to get it to work, but I get errors about not being able to find a method getME for class NULL and lm respectively. Am I doing this right?

installation from source file failed

Dear Fabian,

When I tried to install from source file in my linux machine using
install.packages("PATH/RLRsim_3.0.tar.gz", repos = NULL, type="source")
Error message reported as

*** arch - i386
ERROR: compilation failed for package 'RLRsim'

However, intallation using the windows binary works for my windows machine. What might be the reason?

Thanks a lot.
Ni

extract.lmeDesign(lme4_object) not working

Hello,
is it possible to allow the extraction of a s4 class lme4 object?
Currently it gives an error:

library(lme4)
m<-lme4::lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
extract.lmeDesign(m)
Error: $ operator not defined for this S4 class

sample of exactRLRT

exactRLRT(m0)$sample is a function instead of simulated test statistics. How should I fix it?

model.matrix warning about contrasts

### R code from vignette source 'Ch-LME.Rnw'

###################################################
### code chunk number 1: setup
###################################################
library("MVA")
set.seed(280875)


###################################################
### code chunk number 2: setup
###################################################
library("nlme")

###################################################
### code chunk number 6: ch:LME:timber:tab
###################################################
"timber" <-
matrix(c(0., 0., 0., 0., 0., 0., 0., 0., 2.3799999999999999, 2.6899999999999999, 2.8500000000000001, 2.46,
        2.9700000000000002, 3.96, 3.1699999999999999, 3.3599999999999999, 4.3399999999999999, 4.75,
        4.8899999999999997, 4.2800000000000002, 4.6799999999999997, 6.46, 5.3300000000000001, 5.4500000000000002,
        6.6399999999999997, 7.04, 6.6100000000000003, 5.8799999999999999, 6.6600000000000001, 8.1400000000000006,
        7.1399999999999997, 7.0800000000000001, 8.0500000000000007, 9.1999999999999993, 8.0899999999999999,
        7.4299999999999997, 8.1099999999999994, 9.3499999999999996, 8.2899999999999991, 8.3200000000000003,
        9.7799999999999994, 10.94, 9.7200000000000006, 8.3200000000000003, 9.6400000000000006, 10.720000000000001,
        9.8599999999999994, 9.9100000000000001, 10.970000000000001, 12.23, 11.029999999999999, 9.9199999999999999,
        11.06, 11.84, 11.07, 11.06, 12.050000000000001, 13.19, 12.140000000000001, 11.1, 12.25, 12.85,
        12.130000000000001, 12.210000000000001, 12.98, 14.08, 13.18, 12.23, 13.35, 13.83, 13.15, 13.16, 13.94,
        14.66, 14.119999999999999, 13.24, 14.539999999999999, 14.85, 14.09, 14.050000000000001, 14.74,
        15.369999999999999, 15.09, 14.19, 15.529999999999999, 15.789999999999999, 15.109999999999999,
        14.960000000000001, 16.129999999999999, 16.890000000000001, 16.68, 16.07, 17.379999999999999,
        17.390000000000001, 16.690000000000001, 16.239999999999998, 17.98, 17.780000000000001, 17.940000000000001,
        17.43, 18.760000000000002, 18.440000000000001, 17.690000000000001, 17.34, 19.52, 18.41, 18.219999999999999,
        18.359999999999999, 19.809999999999999, 19.460000000000001, 18.710000000000001, 18.23, 19.969999999999999,
        18.969999999999999, 19.399999999999999, 18.93, 20.620000000000001, 20.050000000000001, 19.539999999999999,
        18.870000000000001)
, nrow = 8, ncol = 15)

slippage <- c((0:10)/10, seq(from = 1.2, to = 1.8, by = 0.2))

colnames(timber) <- paste("s", slippage, sep = "")
timber <- as.data.frame(timber)
timber$specimen <- factor(paste("spec", 1:nrow(timber), sep = ""))

timber.dat <- reshape(timber, direction = "long", idvar = "specimen",
        varying = matrix(colnames(timber)[1:15], nr = 1),
        timevar = "slippage")
names(timber.dat)[3] <- "loads"
timber.dat$slippage <- slippage[timber.dat$slippage]
timber <- timber.dat

###################################################
### code chunk number 11: ch:LME:timber:lme
###################################################
timber.lme <- lme(loads ~ slippage, 
                  random = ~1 | specimen,
                  data = timber, method = "ML")

###################################################
### code chunk number 12: ch:LME:timber:LRT
###################################################
library("RLRsim")

exactRLRT(timber.lme)
#Using restricted likelihood evaluated at ML estimators.
#Refit with method="REML" for exact results.

#	simulated finite sample distribution of RLRT.
	
#	(p-value based on 10000 simulated values)

#data:  
#RLRT = 3.2183e-07, p-value = 0.4419

#Warning message:
#In model.matrix.default(~m$groups[[n.levels - i + 1]] - 1, contrasts.arg = c("contr.treatment",  :
#  non-list contrasts argument ignored

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.