R programming language resources › Forums › Data manipulation › Problem with script compiling
- This topic has 1 reply, 2 voices, and was last updated 14 years ago by
bryan.
- AuthorPosts
- September 19, 2011 at 12:41 am #422
daveisme
MemberHi 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? ThanxSeptember 21, 2011 at 12:43 am #424bryan
ParticipantHi 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.
- AuthorPosts
- You must be logged in to reply to this topic.