'R/R2OpenBUGS does not open OpenBUGS's window (R/R2OpenBUGS can't connect with OpenBUGS)

I'm just started to use OpenBUGS software and R2OpenBUGS packages in R for my thesis project but i have a serious problem. when i use bugs() function, Nothing happens in R Console, the OpenBUGS window and just Remains in the same state. I'm not sure the Code helps or not but this the model any way:

model{

    # Likelihood

    for(i in 1:n.cc){

    z[i] <- equals(reports.star[i], 0)  # I(reports = 0)

    logit(pi[i]) <- gamma[1]*intercept.cc[i] +
        gamma[2]*share[i] +
        gamma[3]*owner[i] +
        gamma[4]*accounts[i]

    mu[i] <- beta[1]*intercept.cc[i] +
        beta[2]*share[i] +
        beta[3]*owner[i] +
        beta[4]*accounts[i] +
        (1 - 2*tau)*w[i]/(tau*(1 - tau))

    prec[i] <- delta*tau*(1 - tau)/(2*w[i])

    log.like[i] <- z[i]*log(1 - pi[i]) + (1 - z[i])*(log(pi[i]) +
        0.5*log(prec[i]/(2*3.14159)) - 0.5*pow(reports.star[i] - mu[i], 2)*prec[i])

    #   zeros trick

    zeros[i] <- 0

    zeros[i] ~ dpois(lambda[i])

    lambda[i] <- -log.like[i] + 10000

    }

    # prior distributions

    for(i in 1:4){

    beta[i] ~ dnorm(0, 0.1)

    gamma[i] ~ dnorm(0, 0.1)
    }

    delta ~ dgamma(0.001, 0.001)


    for(i in 1:n.cc){w[i] ~ dexp(delta)}


}

and this is the main Code:

################################################################################################
######  Defining responses and covariates from credit card data ################################
################################################################################################

library(AER)
data("CreditCard")
zeros <- which(CreditCard$reports == 0)
nonzero <- which(CreditCard$reports != 0)

n.cc <- length(CreditCard$reports)
reports.star <- CreditCard$reports
reports.star[nonzero] <- log(reports.star[nonzero] - runif(length(nonzero)))
save(reports.star, file = "CChurdle_reports.RData")

intercept.cc <- rep(1, n.cc)
share <- CreditCard$share
owner <- as.numeric(CreditCard$owner) - 1
accounts <- CreditCard$active

################################################################################################
######  Running R2OpenBUGS for Quantile Regression  ############################################
################################################################################################

library(R2OpenBUGS)
library(coda)

CC.data <- list("reports.star", "n.cc", "tau", "intercept.cc", "share", "owner", "accounts")

# initial values chosen from prior run at the median
CC.initials <- list(
  list(beta = c(0.1, -3, -0.5, 0.03), gamma = c(-1.7, -5, -0.5, 0.1), delta = 2.1,
       w = rep(0.5, n.cc)),
  list(beta = c(-0.2, -5, -1, 0), gamma = c(-2, -7.5, -1, 0), delta = 1.5, w = rep(1, n.cc)),
  list(beta = c(0.5, -1, 0, 0.1), gamma = c(-1, -2.5, 0, 0.2), delta = 3, w = rep(2, n.cc)))

CC.keeps <- list("beta", "gamma", "delta", "pi", "w")

###### 5th percentile ######

tau <- 0.05

CC.05 <- bugs(model.file = "CChurdle.txt", data = CC.data, inits = CC.initials,
                 n.iter = 7500, n.chains = 3, n.thin = 100, n.burnin = 500,
                 parameters.to.save = CC.keeps, DIC = FALSE)
save(CC.05, file = "CC05.RData")
rm(CC.05)

and this is what i get:

enter image description here

The Codes are taken from an article and are public to use.

hope you folks help me out. Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source