Print

Print


Hi Catherine,

I am not an expert but I can see something missing in the beginning like this:

{
  for (j in 1:J) {
   for (i in 1:I) {
          
          y[i,j]<-resp[i,j]
}}

I would not put ' # ' in front of MODEL statement. 
I may be wrong but with these changes I can get your model run. Please see the whole syntax with a make up data set below. I assumed that you had a problem with running this model. But I don't know how to calculate DIC. I hope this helps.


# definitions
#  I : No of Items
# J : No of examinees
 
model

{
  for (j in 1:J) {
   for (i in 1:I) {
          
          y[i,j]<-resp[i,j]
}}



for (j in 1:J) {                                                   
            for (i in 1:I) {                                               
                logit(prob[i,j]) <- theta[j]-delta[i]
                y[i,j] ~ dbern(prob[i,j])          # response has bernoulli distribution
     }
}
 
 
# Priors and identification
for (j in 1:J)
{
theta[j] ~dnorm(mu,tau)
}
for (i in 1:I)
{
deltaD[i] ~ dnorm(0, 1)
delta[i] <-deltaD[i] - mean(deltaD[])  # sum to zero constraint
    
mu ~ dnorm (0,1)
tau <- 0.368   # appoximates variance of the standard logistic distribution
sigma <- 1/sqrt(tau)    

 }

list((I=9, J=9,
resp = structure(.Data = c(
1,1,1,0,1,1,1,0,0,
1,0,1,0,0,1,0,0,0,
1,1,1,1,1,1,1,1,0,
1,0,0,1,0,1,1,0,0,
1,0,1,1,1,0,1,1,1,
0,0,1,1,1,1,1,0,0,
0,0,1,1,0,1,1,0,0,
0,1,1,1,1,1,1,0,1,
1,1,0,0,0,1,1,1,0),
.Dim = c(9,9)))



Sedat


On Fri, Mar 1, 2013 at 3:29 PM, Catherine Close <[log in to unmask]> wrote:

Hi,

 

I have been trying to compute DIC in WINBUGS without any luck. Everything seems fine with the model, data, and model compile.

 

 

# definitions

#  I : No of Items

# J : No of examinees

 

#MODEL

{

for (j in 1:J) {                                                   

            for (i in 1:I) {                                               

                logit(prob[i,j]) <- theta[j]-delta[i]

                y[i,j] ~ dbern(prob[i,j])          # response has bernoulli distribution

     }

}

 

 

# Priors and identification

for (j in 1:J)

{

theta[j] ~dnorm(mu,tau)

}

for (i in 1:I)

{

deltaD[i] ~ dnorm(0, 1)

delta[i] <-deltaD[i] - mean(deltaD[])  # sum to zero constraint

    

mu ~ dnorm (0,1)

tau <- 0.368   # appoximates variance of the standard logistic distribution

sigma <- 1/sqrt(tau)    

            }

 

 

 

Here’s the trap message I keep getting and really need some help here;

 

 

NIL dereference (read)

 

DeviancePlugin.Monitor.Update   [00000080H]

    .chain                    INTEGER                             0

    .i                           INTEGER                             0

    .monitor                 DeviancePlugin.Monitor         [027886C0H]

 UpdaterActions.UpdateMonitors   [0000011CH]

    .chain                    INTEGER                             0

    .monitor                 UpdaterActions.Monitor         [027886C0H]

 BugsCmds.Action.Step   [00000BCAH]

    .a                          BugsCmds.Action                 [02823B80H]

    .chain                    INTEGER                             0

    .i                           INTEGER                             1

    .j                           INTEGER                             1

    .numChains           INTEGER                             1

BugsCmds.Action.Do   [00000C58H]

    .a                          BugsCmds.Action                 [02823B80H]

    .elapsedTime         LONGINT                             657B21F1657A0384H

    .profileList             ARRAY 2024 OF CHAR        ""   ...

    .res                       INTEGER                             1670599263

    .s                          ARRAY 120 OF CHAR         4E8DX, 7315X, 614X, 11X, 0C019X   ...

Services.Exec   [00000136H]

    .a                          Services.Action                     [02823B80H]

    .t                          POINTER                             [657A0384H]

Services.IterateOverActions   [000002F4H]

    .p                          Services.Action                     [02823B80H]

    .t                          POINTER                             NIL

    .time                     LONGINT                             6107579

Services.StdHook.Step   [0000034DH]

    .h                          Services.StdHook                 [0275E380H]

 HostWindows.Idle   [00004A86H]

    .focus                   BOOLEAN                            FALSE

    .tick                      Controllers.TickMsg              Fields

    .w                         HostWindows.Window           NIL

HostMenus.TimerTick   [00003422H]

    .lParam                 INTEGER                             0

    .ops                      Controllers.PollOpsMsg         Fields

    .wParam               INTEGER                             1

    .wnd                     INTEGER                             1114886

Kernel.Try   [00003A61H]

    .a                          INTEGER                             1114886

    .b                          INTEGER                             1

    .c                          INTEGER                             0

    .h                          PROCEDURE                      HostMenus.TimerTick

HostMenus.ApplWinHandler   [00003841H]

    .Proc                     PROCEDURE                      NIL

    .hit                        BOOLEAN                            Undefined98

    .lParam                 INTEGER                             0

    .message              INTEGER                             275

    .res                       INTEGER                             1

    .s                          ARRAY 256 OF SHORTCHAR      "$ú("   ...

    .w                         INTEGER                             2425500

    .wParam               INTEGER                             1

    .wnd                     INTEGER                             1114886

<system>   (pc=761562F9H,  fp=0028FB3CH)

<system>   (pc=76156D39H,  fp=0028FBB4H)

<system>   (pc=761577C3H,  fp=0028FC14H)

<system>   (pc=76157BC9H,  fp=0028FC24H)

HostMenus.Loop   [00003BDEH]

    .done                    BOOLEAN                            FALSE

    .f                          SET                                     {0..5}

    .n                          INTEGER                             10

    .res                       INTEGER                             0

    .w                         HostWindows.Window           NIL

Kernel.Start   [00002B8CH]

    .code                    PROCEDURE                      HostMenus.Loop

 

 

Your help will be greatly appreciated!

 

Catherine

 

 

Catherine

 

------------------------------------------------------------------- This list is for discussion of modelling issues and the BUGS software. For help with crashes and error messages, first mail [log in to unmask] To mail the BUGS list, mail to [log in to unmask] Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments to the list. To leave the BUGS list, send LEAVE BUGS to [log in to unmask] If this fails, mail [log in to unmask], NOT the whole list



--
SS
------------------------------------------------------------------- This list is for discussion of modelling issues and the BUGS software. For help with crashes and error messages, first mail [log in to unmask] To mail the BUGS list, mail to [log in to unmask] Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments to the list. To leave the BUGS list, send LEAVE BUGS to [log in to unmask] If this fails, mail [log in to unmask], NOT the whole list