Giter Site home page Giter Site logo

Comments (9)

clementinezimnicki avatar clementinezimnicki commented on July 20, 2024

Hi! I'm having this same issue. Did you ever figure it out?

from mixedpower.

Yufanggg avatar Yufanggg commented on July 20, 2024

Is this issue figured out? I have the same one?

from mixedpower.

lkumle avatar lkumle commented on July 20, 2024

Hi everyone! Sorry for this very delayed response! We added an FAQ that also covers the error message reported here.

https://lkumle.github.io/power_notebooks/intro/FAQ_mixedpower.pdf

Usually, this error occurs when mixedpower cannot use the model's formula to infer column names in the data set used to fit the model (e.g., here, mixedpower will look for a variable called "longdaylanguage". Separating them by either + or * should solve the issue).

from mixedpower.

YesimSem avatar YesimSem commented on July 20, 2024

Hi,

I am having this problem and my variables are named correctly (as they are in the dataframe). What is the solution for this? Thank you

Edit: My model has 3 way interaction, could that be a reason?

from mixedpower.

lisakaly avatar lisakaly commented on July 20, 2024

m4<-lmer(MRSS~ Time * Group+ subset_ssc+ ( 1|subject),data=df, REML = T)

model <- m4 # which model do we want to simulate power for?
data <- df # data used to fit the model
fixed_effects <- c("Time", "subset_ssc", "Group") # all fixed effects specified in m3
simvar <- "subject" # which random effect do we want to vary in the simulation?

SIMULATION PARAMETERS

steps <- c( 40, 50, 60, 80) # which sample sizes do we want to look at?
critical_value <- 2 # which t/z value do we want to use to test for significance?
n_sim <- 500 # how many single simulations should be used to estimate power?

RUN SIMULATION

power_m4<- mixedpower(model=m4, data=df, fixed_effects=c("Time", "subset_ssc", "Group"),
simvar="subject", steps=c(40,50,60,80), critical_value=2, n_sim=500)

This the console response:
[1] "Estimating power for step:"
[1] 40
[1] "Simulations for step 40 are based on 0 successful single runs"
Error in apply(store_simulations, MARGIN = 1, FUN = mean, na.rm = T) :
dim(X) must have a positive length

How can I fix this problem . My variables are named the same in the data set as in the model. And the solution suggested by Ikumie does not really fit to my case....
Thank you for helping

from mixedpower.

lkumle avatar lkumle commented on July 20, 2024

Hi,

another common source of this error are problems with identifying if a predictor is between- or within-subject. Data sets simulated by mixedpower keep the balance between groups which requires identifying which predictors are between-subject. This fails if e.g., between-subject variables have missing values.

Feel free to reach out via email if this does not apply to your data and I could have a closer look at your data/code.

from mixedpower.

paulwarren avatar paulwarren commented on July 20, 2024

I am also having this problem. I have checked the suggested solutions above and none of them seem to apply to my dataset. Are there any other issues I should be looking for?

UPDATE: I did a fresh installation of all the packages required to install mixedpower, and it now runs okay. So it seems like there was an issue with an old package that was not being reported as such but resulted in this apply error

from mixedpower.

AleAnsani avatar AleAnsani commented on July 20, 2024

Hi everyone! I'm getting the exact same error message, and no fresh installation worked.

Here's something potentially new I've discovered:
If I run the lmer version of my glmer model, the simulations run just fine.

That is:
doesnotwork <- glmer(y ~ treatment * time + (1|ID) + (1|stim), family=Gamma(link="log"), data=data)
works <- lmer(y ~ treatment * time + (1|ID) + (1|stim), data=data)

I've also tried with no link function (i.e., identity link function), maybe the log link modifies something inside the lme4 function?! But no success.

@lkumle did this workaround work for other users as well? Any suggestions?
I'd like to run my simulations on my glmer, as it would be more appropriate.

Thank you for your collaboration!

from mixedpower.

lkumle avatar lkumle commented on July 20, 2024

Hi @AleAnsani ,

In general, "Simulations for step X are based on 0 successful single runs" and "Error in apply(store_simulations, MARGIN = 1, FUN = mean, na.rm = T) : dim(X) must have a positive length" are unfortunately very uninformative error messages. All it allows to conclude is that something went wrong during the simulation process, but it can arise from many different issues.

In your specific case, I know that other users have had issues when using mixedpower with glmer and family = Gamma(), which unfortunately just does not seem to be stable enough at this point. Sorry for not having any concrete suggestions on how to solve this!

from mixedpower.

Related Issues (10)

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.