Problem with script compiling

R programming language resources Forums Data manipulation Problem with script compiling

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #422
    daveisme
    Member

    Hi guys
    I’m new at R language and I have a script compiling problem.

    I’m trying to compile this script:

    ###
    model_logistic
    {
    for (i in 1:N)
    {Y[i]~ dbin(theta[i], 1)
    logit(theta[i] <- beta.0+beta.1*X[i]} } beta.0 ~ dnorm(0, 0.0001) beta.1 ~ dnorm(0, 0.0001) or <-exp(beta.1) } ### by typing: > source(“question2bis_code.R”)

    But it gives me this error:

    Error in source(“question2bis_code.R”) :
    question2bis_code.R:7:45: unexpected ‘}’
    {Y[i]~ dbin(theta[i], 1)
    logit(theta[i] <- beta.0+beta.1*X[i]} Why do I get this? Why this error? Thanx

    #424
    bryan
    Participant

    Hi daveisme,

    What exactly are you trying to do? You usually don’t have to compile code in R. Are you just trying to create and include a function? If so, you probably want something more like this in your included code:

    model_logistic <- function { beta.0 ~ dnorm(0, 0.0001) beta.1 ~ dnorm(0, 0.0001) for (i in 1:N) { Y[i]~ dbin(theta[i], 1) logit(theta[i] <- beta.0+beta.1*X[i] } or <-exp(beta.1) }

    This is just an approximation based on a guess at your goal, but it should help you make some progress.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Scroll to top
Privacy Policy