[R] Censoring in R2OpenBUGS

arnabkm2007 maity at math.niu.edu
Sun Feb 15 15:30:38 CET 2015


Thank you so much Uwe. It seems working.

Thanks & Regards,
Arnab



Arnab Kumar Maity
Graduate Teaching Assistant
Division of Statistics
Northern Illinois University
DeKalb, IL 60115
Email: maity at math.niu.edu
Ph:     779-777-3428

On Thu, Feb 12, 2015 at 4:02 PM, Uwe Ligges-3 [via R] <
ml-node+s789695n4703197h57 at n4.nabble.com> wrote:

> On 12.02.2015 16:05, arnabkm2007 wrote:
>
> > Hi,
> >
> > I am trying to run the following model for OpenBUGS and want to use
> > R2OpenBUGS package. The model specifies weibull distribution for
> censored
> > data.
> >
> >
> >    weibull.model <- function()
> >    {
> >
> >      for(i in 1:n)
> >      {
> >
> >        exp.alpha[i] ~ dgamma(a.alpha, b.alpha)
> >        alpha[i] <- log(exp.alpha[i])
> >
> >        linear.part[i] <- alpha[i] + inprod(nu[ ], x[i, ])
> >        lambda[i] <- exp(linear.part[i])
> >
> >        time[i] ~ (dweib(shape, lambda[i]) C(censored.time[i], ))
> >
> >      }
> >
> >      shape ~ dgamma(a.shape, b.shape)
> >
> >      for(j in 1:p)
> >      {
> >
> >        beta[j]  ~ dnorm(prior.mean, prior.tau)
> >        gamma[j] ~ dbern(pi[j])
> >        pi[j]    ~ dbeta(1, 1)
> >        nu[j]   <- beta[j] * gamma[j]
> >
> >      }
> >
> >    }
> >
> >
> >
> > But R is throwing the following error.
> >
> > Error: unexpected symbol in:
> > "
> >        time[i] ~ (dweib(shape, lambda[i]) C"
> >
> > Any help regarding this will be appreciated.
>
> See ?write.model:
>
> "As a difference, BUGS syntax allows truncation specification like this:
> dnorm(...) I(...) but this is illegal in R. To overcome this
> incompatibility, use dummy operator %_% before I(...): dnorm(...) %_%
> I(...). The dummy operator %_% will be removed before the BUGS code is
> saved."
>
> Best,
> Uwe Ligges
>
>
>
>
>
> > Thanks & Regards,
> > Arnab
> >
> >
> > Arnab Kumar Maity
> > Graduate Teaching Assistant
> > Division of Statistics
> > Northern Illinois University
> > DeKalb, IL 60115
> > Email: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4703197&i=0>
> > Ph:     779-777-3428
> >
> >
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=4703197&i=1>
> mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> ______________________________________________
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4703197&i=2>
> mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160p4703197.html
>  To unsubscribe from Censoring in R2OpenBUGS, click here
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4703160&code=bWFpdHlAbWF0aC5uaXUuZWR1fDQ3MDMxNjB8MTMwNTA3NDMzMA==>
> .
> NAML
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160p4703285.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]



More information about the R-help mailing list