Problem #1 update

| | Comments (4)
Kathryn pointed out that I should make it explicit that there are no A0A123 offspring from the first mother. I've updated the assignment accordingly.

4 Comments

I have never used winbugs before so forgive me if this is an ignorant question, but... When I get to the "Sample" step, while working through the example problem, I receive the error message monitor could not be set when I enter the variable "k" and press set. Have any ideas what I might be doing wrong.

I think there's probably only one person in class who's used WinBUGS before, so you're not alone. WinBUGS is confusing until you get used to how it thinks. The relevant line in the code is this one:

k ~ dbin(p, N)

Think about what that means. We have a sample of k=7 out of a sample of size N=20. In other words, we know k and N. What we don't know is p. So p is what you need to monitor.

More generally, k and N are the data and p is the unknown parameter. What you'll want to monitor in WinBUGS is the unknown parameter.

I apologize, I actually was entering "p" before and just miss wrote it in the question. The problem still stands even with "p" entered in the node box.

This is the code you're using, right?


model {

# likelihood
k ~ dbin(p, N)

# prior
p ~ dunif(0,1)

}

list(k = 7, N = 20)


Make sure you're following these steps:


Highlight "model". Select Model->Specification. Click on "Check model" in the Specification tool.
Highlight "list". Click on "Load data" in the Specification tool.
Click on compile in the Specification tool. You should see the "Load inits" and "Gen inits" buttons become active.
Click on "Gen inits" in the Specification tool.
Select Model->Update menu, and click "Update" in the Update tool.
Select Inference->Samples. Then enter "p" in the Sample monitor tool and click "Set".
Then click on "Update" in the Update tool again.
Enter "*" in the Sample monitor tool and select click on "stats" to see the summary statistics of "history" to see the trace of the simulation.

It just dawned on me that you may be trying to enter "p" in the box that's asking for the number of steps in the update, rather than in the one where you monitor parameters.

Leave a comment

About this Entry

This page contains a single entry by Kent published on August 29, 2008 1:22 PM.

Problem #1 posted was the previous entry in this blog.

Getting to know WinBUGS is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.