0

我使用 logit 模型进行了分析,现在想使用 probit 模型进行分析。谁能把这个winbugs logit模型变成一个winbugs probit模型?

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)
4

1 回答 1

6

WinBUGS 接受多种类型的链接函数(参见 WinBUGS手册中的第 15 页)。对于概率模型,将线性回归方程更改为:

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

我建议您将年龄变量居中,否则您可能会遇到一些收敛问题,例如:

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

或者,对于概率模型(如果probit函数给您一些陷阱错误),您可以使用phi标准的普通 cdf 函数:

 p[i] <- phi(alpha + b.sex*sex[i] + b.age*(age[i] - mean(age[])))
于 2013-01-14T11:25:57.447 回答