2
$\begingroup$

I'm very new to Bayesian analysis, and I've come up with the following model. My goal is to get for each individual "test unit" a distribution that describes the lift in success rate under one of several test conditions.

#data
N <- 50000 #Number of test units
T <- 2 #Number of test conditions
succs<-structure(c(...N x T...))
trials<-structure(c(...N x T...))

#model
model {
for (j in 1:T) {
    TestCondition[j] ~ dnorm(0, TestCondition.tau)
}
for (i in 1:N) {
    Unit[i] ~ dnorm(0, Unit.tau)
}
for (i in 1:N) {
    for(j in 1:T){
        succs[i,j] ~ dbin(p[i,j],trials[i,j])
        eps[i,j] ~ dnorm(0, eps.tau)
        logit(p[i,j]) <- mu + Unit[i] + TestCondition[j] + eps[i,j]
        for(k in 1:j-1){ #Only compute pairwise when non-redundant
            delta[i,(j-1)*(j-2)/2+k] <- p[i,j]-p[i,k]
        }
    }
}
mu ~ dlogis(0, 1)
TestCondition.tau ~ dgamma(2,2)
Unit.tau ~ dgamma(2,2)
eps.tau ~ dgamma(2,1)
}

1) Is the above model appropriate for the problem I'm trying to solve?

2) The model takes a long time for large datasets (which is basically all of my datasets). Are there any ways to reformulate the model so it can handle large datasets better?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.