Skip to main content
addition
Source Link

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

Yhat[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

You can also "pre-calculate" the values of M for each observation (from the t,v & u of the observation) and supply this as data to the model as:

Yhat[i] <- M[i] # or skipping this step since it's redundant 

This means that Yhat[i] is directly calculated from your simulation, and the step is redundant. You could just as well give Yhat as data (directly in Openbugs or e.g. called from R through R2Openbugs). Without knowing the exact purpose of your modelling exercise it is difficult to know what you want to accomplish with the MCMC model.

If you need more flexibility to create user-defined functions, maybe to make external calls, you should look at STAN, where I think this is possible to a larger extent (I haven't used STAN though).

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

Yhat[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

You can also "pre-calculate" the values of M for each observation (from the t,v & u of the observation) and supply this as data to the model as:

Yhat[i] <- M[i] # or skipping this step since it's redundant 

This means that Yhat[i] is directly calculated from your simulation, and the step is redundant. You could just as well give Yhat as data (directly in Openbugs or e.g. called from R through R2Openbugs). Without knowing the exact purpose of your modelling exercise it is difficult to know what you want to accomplish with the MCMC model.

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

Yhat[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

You can also "pre-calculate" the values of M for each observation (from the t,v & u of the observation) and supply this as data to the model as:

Yhat[i] <- M[i] # or skipping this step since it's redundant 

This means that Yhat[i] is directly calculated from your simulation, and the step is redundant. You could just as well give Yhat as data (directly in Openbugs or e.g. called from R through R2Openbugs). Without knowing the exact purpose of your modelling exercise it is difficult to know what you want to accomplish with the MCMC model.

If you need more flexibility to create user-defined functions, maybe to make external calls, you should look at STAN, where I think this is possible to a larger extent (I haven't used STAN though).

addition
Source Link

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

y[i]Yhat[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

You can also "pre-calculate" the values of M for each observation (from the t,v & u of the observation) and supply this as data to the model as:

Yhat[i] <- M[i] # or skipping this step since it's redundant 

This means that Yhat[i] is directly calculated from your simulation, and the step is redundant. You could just as well give Yhat as data (directly in Openbugs or e.g. called from R through R2Openbugs). Without knowing the exact purpose of your modelling exercise it is difficult to know what you want to accomplish with the MCMC model.

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

y[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

Yhat[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

You can also "pre-calculate" the values of M for each observation (from the t,v & u of the observation) and supply this as data to the model as:

Yhat[i] <- M[i] # or skipping this step since it's redundant 

This means that Yhat[i] is directly calculated from your simulation, and the step is redundant. You could just as well give Yhat as data (directly in Openbugs or e.g. called from R through R2Openbugs). Without knowing the exact purpose of your modelling exercise it is difficult to know what you want to accomplish with the MCMC model.

addition
Source Link

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. Or have I completely misunderstooddon't know the specifics of your questionfunction, but as an made-up example case a function M(t,u,v) could be written as:

y[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. Or have I completely misunderstood your question?

In your question you are assigning a value to y[i], not describing how the y's are distributed. If I understand you correctly, you want to describe the deterministic/predicted value Yhat using the function M(t,u,v), with the stochastic/sampling process determined by a normal distribution (i.e. the actual observations). This can be accomplished by:

 y[i] ~ dnorm(Yhat[i], tau.sigma_y)
 Yhat[i] <- M(t,u,v)

In more general terms:

$$y_i \sim \mathcal{N}(\hat{y}_i,\sigma^2_y) \\ \hat{y}_i = M(t,u,v)$$ You then need to feed the correct values from the function M to each observation (through Yhat), but that can be accomplished in several different ways. I don't know the specifics of your function, but as an made-up example case a function M(t,u,v) could be written as:

y[i] <- exp(beta1*t[i]) - (beta2 * u[i] * abs(v[i]))/(beta3 + u[i])

Here values of u, v and t for observation i is fed to Bugs as data and the parameters beta1, beta2 and beta3 are estimated (and you need to supply initial values of these). Or do you have a function M that truly cannot be specified in Bugs?

clarification and generalization
Source Link
Loading
Source Link
Loading