getgrad <-
function(t, rho, k, n, q)
{
s <- sum(n[t==1])
sN <- sum(n)-s
sq <- sum(q[t==1])
sQ <- sum(q)-sq
g1 <- (1-k)/s^2 * (sq*n - s*q)
g2 <- k/sN^2 * (sQ*n - sN*q)
g1+g2
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.