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

  • Home
  • SEARCH
  • 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 9213837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:50:29+00:00 2026-06-18T01:50:29+00:00

I have been trying to run a R code to use OpenBugs. It was

  • 0

I have been trying to run a R code to use OpenBugs. It was working well till yesterday and I do not know what I did that it started showing some error. Then I decided to see if some simple example works well. So I tried the schools example present in R2WinBUGS vignettes.

The model in file schools.txt is

sink("schools.txt")
cat("
      model {
      for (j in 1:J)
      {
        y[j] ~ dnorm (theta[j], tau.y[j])
        theta[j] ~ dnorm (mu.theta, tau.theta)
        tau.y[j] <- pow(sigma.y[j], -2)
      }
      mu.theta ~ dnorm (0.0, 1.0E-6)
      tau.theta <- pow(sigma.theta, -2)
      sigma.theta ~ dunif (0, 1000)
    }",fill=TRUE)
sink()

The code for running the rest of the program is as follows:

    data(schools)
 J <- nrow(schools)
 y <- schools$estimate
 sigma.y <- schools$sd
 data <- list ("J", "y", "sigma.y")

inits <- function()
{ 
  list(theta = rnorm(J, 0, 100), mu.theta = rnorm(1, 0, 100),sigma.theta = runif(1, 0, 100))
}

schools.sim <- bugs(data, inits, model.file = "schools.txt",parameters = c("theta", "mu.theta", "sigma.theta"),n.chains = 3, n.iter = 1000) 

Unfortunately, I am getting the same error as before.

 > schools.sim <- bugs(data, inits, model.file = "schools.txt",parameters = c("theta", "mu.theta", "sigma.theta"),n.chains = 3, n.iter = 1000)
    Error in sd(as.vector(ai)) : unused argument(s) (as.vector(ai))

I have also tried specifying program=c('OpenBugs') But that gives me another weird error given that OpenBugs is in the path

     Error in bugs(data, inits, model.file = "schools.txt", parameters = c("theta",  : 
  unused argument(s) (program = c("OpenBugs"))

EDIT

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] abind_1.4-0        rjags_3-9          R2WinBUGS_2.1-18   BRugs_0.8-0        R2OpenBUGS_3.2-2.1
[6] LearnBayes_2.12    coda_0.16-1        lattice_0.20-10   

loaded via a namespace (and not attached):
[1] boot_1.3-7    grid_2.15.2   plyr_1.8      stringr_0.6.2 tools_2.15.2 

traceback() gives…

> traceback()
No traceback available

EDIT-2

  > getAnywhere("sd")
2 differing objects matching ‘sd’ were found
in the following places
  .GlobalEnv
  package:stats
  namespace:stats
Use [] to view one of them` 

How should I remove the sd that I defined and that is sitting in .GlobalEnv?

EDIT-3

Problem solved. I removed the object sd from the workspace and everything worked.

  • 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-18T01:50:31+00:00Added an answer on June 18, 2026 at 1:50 am

    I think you’ve somehow gotten a weird version of sd defined. What are the results of getAnywhere("sd")$where? It should be "package:stats" "namespace:stats". If you did attach(schools) I can see that would create another object named sd in your workspace, but that shouldn’t cause problems because it’s not a function.

    Solution: rm(sd) or rm("sd") (the latter is probably better)

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

Sidebar

Related Questions

I understand that I should use mod_wsgi to run Python, and I have been
I have been trying to run a Avro map-reduce on oozie. I specify the
I've been trying to optimize a numeric program of mine, and have run into
Have been trying to encrypt an xml file to a string so that I
I am trying to use the following conventions I have been instructed to use
I'm currently trying to consume a FORTRAN DLL that I have been given by
I have been trying to use the new Geolocation API. I got an API
I have been trying to use g++ to compile a program with SDL. The
I have been trying to create a Ruby program that will be running online
I have been trying to use temporary tables along with nhibernate. The following piece

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.