Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:47+00:00 2026-06-13T05:59:47+00:00

I am trying to fit an ANOVA model into rjags. The model is like

  • 0

I am trying to fit an ANOVA model into rjags. The model is like this

for (r in 1:nE){
  for ( j in 1:nP){
    for ( i in 1:nA){
      logit(p[i,j,r]) <- mu[r] + theta[i,r] + varphi[j,r] + psi[(nA-i)+j,r]
    }
  }
}

And I need to fit in the constraints that

for (r in 1:nE){
  theta[nA,r] <- 0 - sum(theta[1:(nA-1), r])
  varphi[nP,r] <- 0 - sum(varphi[1:(nP-1), r])
  psi[nK,r] <- 0 - sum(psi[1:(nK-1), r])
}

which is the sum to zero constraints for this model. However, rjags gives me the message

"Compilation error on line 14. Attempt to redefine node varphi[16,1]"

If I delete the constraint part, the model compiled just fine but will not converge. In BUGS, the model is accepted.

How can I implement these constraints in rjags?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:59:48+00:00Added an answer on June 13, 2026 at 5:59 am

    You have two options:

    1. Make new zero sum variables (don’t redefine the old ones) and monitor them instead.

    2. Reparameterize the model to use a corner constraint rather than summing to zero.

    1 is the better option since the new variables will probably converge faster. See Ntzoufras’ book, (ch.5), sec. 5.4.2 for a discussion and also the relevant bugs code. This should also work for jags, although I haven’t checked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to fit an image into a <td> that is smaller than the
I am trying to fit two CheckBoxes into a single TableRow , so that
I'm trying to fit a 20x20 table into a view using a programmatically built
I find myself always trying to fit everything into the OOP methodology, when I'm
I have installed rapache and I am trying to fit a linear model inside
I'm trying to fit 3 pictures in one HTML page, such that maximum screen
I am trying to fit a sentence that changes often, in to a few
I have one long word... p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx+wnDhlr7GqHiH6lAaPPuN5F7RjUrtvGyxxZkClJsLaTDeqg/FuJXU7RYdPQ2Ka++tfw0Z9+SRKatLUQQeCqLK8z1/V4p7BaJKPkegMzXgWGnFVmz1tdLFiYUGq0MvVgqWiepcTFmwgSd9g1pGRiCSDHJUDwcc+NidiW4/ixw4QIDAQAB ...that I am trying to fit in a
Im trying to fit a swimming pool onto this piece of terrain. The terrain
I am trying to curve fit some periodical experimental data, and discovered that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.