[R-br] Erro ao rodar Wibugs/Openbugs

Alisson Lucrécio alisson.lucrecio em ifgoiano.edu.br
Sábado Novembro 8 15:54:17 BRST 2014


Victor,

Minha sugestão é que vc sustituia o código rbug por rstan, o rbug é muito
problemático e ineficente, mande um CMR. Vc conseguiu rodar o rstar?

Att.

2014-11-08 15:52 GMT-02:00 Alisson Lucrécio <
alisson.lucrecio em ifgoiano.edu.br>:

> Victor,
>
> Minha sugestão é que vc sustituia o código rbug por rstan, o rbug é muito
> problemático e ineficente, mande um CRM. Vc conseguiu rodar o rstar?
> Att.
>
> 2014-11-08 15:38 GMT-02:00 Victor Eduardo [via R-br] <
> ml-node+s2285057n4663486h2 em n4.nabble.com>:
>
> Não rodou aqui. =/
>>
>> O erro que tinha incialmente eu consegui arrumar, só que agora surgiu
>> outro
>>
>> Error in handleRes(res) : NA
>>
>>
>> Só que não tem NA na minha base de dados
>>
>> 2014-11-08 14:10 GMT-02:00 Alisson Lucrécio <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=4663486&i=0>>:
>>
>>> Caro Victor,
>>>
>>> Se der certo teste esse exemplo.
>>>
>>> library(rstan)
>>>
>>> treatment_level <- c("0", "5", "10", "15")
>>> repetition_number <- 20
>>> response_mean <- c(100, 94, 88, 82)
>>>
>>> treatment <- gl(n = length(treatment_level), k = repetition_number,
>>> labels = treatment_level)
>>> str_error <- 2
>>>
>>> response_temp <- sapply(response_mean, function(x){
>>>   response <- rnorm(n = repetition_number, mean = x, sd = str_error)
>>> })
>>>
>>> response <- c(response_temp)
>>>
>>> plot(response ~ treatment)
>>>
>>> summary(lm(response ~ treatment -1))
>>>
>>> mean(response)
>>> sd(response)
>>>
>>> stan_data <- list(N = length(response), I = length(treatment_level),
>>> Treatment=as.numeric(treatment), Response = response)
>>>
>>> # Bayesian method for estimate mean and standard error by treatment
>>>
>>> stan_modelcode <- "
>>> data {                                    // data setup
>>>   int<lower=0> N;                         // sample size
>>>   int<lower=1> I;                         // number of treatments
>>>   real Response[N];                       // Response
>>>   int<lower=1, upper=I> Treatment[N];     // Treatment
>>> }
>>>
>>> parameters {
>>>   real mu[I];
>>>   real<lower=0, upper=100> sigma[I];
>>> }
>>>
>>> model {
>>>   //Priors
>>>   mu ~ normal(0, 100);
>>>   sigma ~ uniform(0, 100);
>>>   //Likelihood
>>>   for(i in 1:N) {
>>>     Response[i] ~ normal(mu[Treatment[i]], sigma[Treatment[i]]);
>>>   }
>>> }
>>> "
>>>
>>> fit <- stan(model_code = stan_modelcode, data = stan_data, iter = 1000,
>>> chains = 3,
>>>             verbose = TRUE)
>>>
>>> plot(fit)
>>>
>>> 2014-11-08 14:09 GMT-02:00 Alisson Lucrécio <[hidden email]
>>> <http://user/SendEmail.jtp?type=node&node=4663486&i=1>>:
>>>
>>> Use esse código.
>>>>
>>>> Sys.setenv(MAKEFLAGS = "-j4")
>>>> source('http://mc-stan.org/rstan/install.R', echo = TRUE,
>>>> max.deparse.length = 2000)
>>>> install_rstan()
>>>>
>>>> 2014-11-08 13:41 GMT-02:00 Victor Eduardo [via R-br] <[hidden email]
>>>> <http://user/SendEmail.jtp?type=node&node=4663486&i=2>>:
>>>>
>>>>> Oi Alisson, o pacote deu erro para instalar. Tanto pelo arquivo quando
>>>>> pelo código install.packages
>>>>>
>>>>>
>>>>> Esse erro que está acontecendo comigo é no modelo? Porque
>>>>> aparentemente está tudo ok com ele.
>>>>>
>>>>> Em 8 de novembro de 2014 13:01, Alisson Lucrécio <[hidden email]
>>>>> <http://user/SendEmail.jtp?type=node&node=4663483&i=0>> escreveu:
>>>>>
>>>>>> Victor,
>>>>>>
>>>>>> Boa tarde.
>>>>>>
>>>>>> Use o pacote rstan.
>>>>>>
>>>>>> Att.
>>>>>>
>>>>>>
>>>>>> 2014-11-08 12:53 GMT-02:00 Victor Eduardo [via R-br] <[hidden email]
>>>>>> <http://user/SendEmail.jtp?type=node&node=4663483&i=1>>:
>>>>>>
>>>>>> Pessoal, estou rodando um modelo de regressão pelo Openbugs. Na hora
>>>>>>> de rodar ele da o seguinte erro durante o processo
>>>>>>>
>>>>>>>
>>>>>>> Error in BRugs::samplesSet(parametersToSave) :
>>>>>>>   model must be initialized before monitors used
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> O que seria exatamente isso?  Já mexi em tudo quanto é configuração
>>>>>>> e código do meu modelo e nada até agora
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Atenciosamente,
>>>>>>>
>>>>>>>
>>>>>>> Victor Eduardo
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> R-br mailing list
>>>>>>> [hidden email]
>>>>>>> <http://user/SendEmail.jtp?type=node&node=4663480&i=0>
>>>>>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>>>>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e
>>>>>>> forneça código mínimo reproduzível.
>>>>>>>
>>>>>>> ------------------------------
>>>>>>>  If you reply to this email, your message will be added to the
>>>>>>> discussion below:
>>>>>>>
>>>>>>> http://r-br.2285057.n4.nabble.com/R-br-Erro-ao-rodar-Wibugs-Openbugs-tp4663480.html
>>>>>>>  To unsubscribe from R-br, click here.
>>>>>>> NAML
>>>>>>> <http://r-br.2285057.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>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Alisson Lucrecio da Costa
>>>>>>
>>>>>> _______________________________________________
>>>>>> R-br mailing list
>>>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4663483&i=2>
>>>>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>>>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
>>>>>> código mínimo reproduzível.
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> R-br mailing list
>>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4663483&i=3>
>>>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
>>>>> código mínimo reproduzível.
>>>>>
>>>>> ------------------------------
>>>>>  If you reply to this email, your message will be added to the
>>>>> discussion below:
>>>>>
>>>>> http://r-br.2285057.n4.nabble.com/R-br-Erro-ao-rodar-Wibugs-Openbugs-tp4663480p4663483.html
>>>>>  To unsubscribe from R-br, click here.
>>>>> NAML
>>>>> <http://r-br.2285057.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>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Alisson Lucrecio da Costa
>>>>
>>>
>>>
>>>
>>> --
>>> Alisson Lucrecio da Costa
>>>
>>> _______________________________________________
>>> R-br mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4663486&i=3>
>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
>>> código mínimo reproduzível.
>>>
>>
>>
>> _______________________________________________
>> R-br mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4663486&i=4>
>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
>> código mínimo reproduzível.
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://r-br.2285057.n4.nabble.com/R-br-Erro-ao-rodar-Wibugs-Openbugs-tp4663480p4663486.html
>>  To unsubscribe from R-br, click here
>> <http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3357982&code=YWxpc3Nvbi5sdWNyZWNpb0BpZmdvaWFuby5lZHUuYnJ8MzM1Nzk4MnwtNTI1NDI5NDE3>
>> .
>> NAML
>> <http://r-br.2285057.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>
>>
>
>
>
> --
> Alisson Lucrecio da Costa
>



-- 
Alisson Lucrecio da Costa
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20141108/f34da3a5/attachment.html>


Mais detalhes sobre a lista de discussão R-br