stan-dev / stan-dev/rstanarm

Can't use init = 0 when >2 group specific terms in stan_{g}lmer

Open
#230 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
401
Forks
136
PR merge metrics
No merged PRs in 30d

Description

Summary:

stan_{g}lmer always returns an error when init = 0 and there are > 2 group-specific parameters.

Description:

This is only a small bug and you may already be aware of it. Using init = "random" solves the problem. The bug seems to be caused by the Stan make_theta_L function. When init = 0 and there are > 2 group-specific parameters, then make_theta_L returns a vector which contains some NaN values at initialisation.

Reproducible Steps:

library(lme4)
library(rstanarm)
m1 <- stan_lmer(Reaction ~ poly(Days, 2) + (poly(Days, 2) | Subject), sleepstudy, init = 0)

And I seemed to get a similar error on other example datasets.

RStanARM Version:

2.15.3, downloaded from CRAN

R Version:

R 3.4.1

Operating System:

Windows 10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied stan_lmer reproducible example with init = 0 and compare it with init = "random". Start by inspecting the Stan make_theta_L function and its initialization inputs; done means the example no longer produces NaN values or the initialization error with more than two group-specific parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.