Question

I conducted an analysis using a logit model and now want to do the same using a probit model. Can anyone please turn this winbugs logit model into a winbugs probit model?

model
 {
 for (i in 1:n) {
 # Linear regression on logit
 logit(p[i]) <- alpha + b.sex*sex[i] + b.age*age[i]
 # Likelihood function for each data point
 frac[i] ~ dbern(p[i])
 }
 alpha ~ dnorm(0.0,1.0E-4) # Prior for intercept
 b.sex ~ dnorm(0.0,1.0E-4) # Prior for slope of sex
 b.age ~ dnorm(0.0,1.0E-4) # Prior for slope of age
 }
 Data
 list(sex=c(1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,    1,
  1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1,     1, 1, 0,
  0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0,   1, 1, 1,
  0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1),
  age= c(69, 57, 61, 60, 69, 74, 63, 68, 64, 53, 60, 58, 79, 56, 53, 74, 56, 76, 72,
  56, 66, 52, 77, 70, 69, 76, 72, 53, 69, 59, 73, 77, 55, 77, 68, 62, 56, 68, 70, 60,
  65, 55, 64, 75, 60, 67, 61, 69, 75, 68, 72, 71, 54, 52, 54, 50, 75, 59, 65, 60, 60,
  57, 51, 51, 63, 57, 80, 52, 65, 72, 80, 73, 76, 79, 66, 51, 76, 75, 66, 75, 78, 70,
  67, 51, 70, 71, 71, 74, 74, 60, 58, 55, 61, 65, 52, 68, 75, 52, 53, 70),
  frac=c(1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1,   1, 0,
  1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,    1, 1, 1,
  1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1,   1, 1, 1,
  1, 0, 1, 1, 0, 0, 1, 0, 0, 1),
  n=100)
  Initial Values
  list(alpha=0, b.sex=1, b.age=1)
Was it helpful?

Solution

WinBUGS accepts multiple types of link functions (see page 15 in the WinBUGS manual). For a probit model, change your linear regression equation to:

probit(p[i]) <- alpha + b.sex*sex[i] + b.age*age[i]

I would recommend you center the age variable, otherwise you may well run into some convergence problems, so something like:

probit(p[i]) <- alpha + b.sex*sex[i] + b.age*(age[i] - mean(age[]))

Alternatively, for a probit model (if the probit functions gives you some trap errors) you could use the phi standard normal cdf function:

 p[i] <- phi(alpha + b.sex*sex[i] + b.age*(age[i] - mean(age[])))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top