Skip to content

Instantly share code, notes, and snippets.

@sachsmc
Last active August 29, 2015 13:55
Show Gist options
  • Save sachsmc/8741525 to your computer and use it in GitHub Desktop.
Save sachsmc/8741525 to your computer and use it in GitHub Desktop.
favre <- function(model, coeff.index){
favre2 <- matrix(c(1, -1, 0, 0,
1, 0, -1, 0,
1, 0, 0, -1
), nrow = 3, ncol = 4, byrow = T)
theta.hat <- favre2 %*% as.matrix(model$coeff[coeff.index])
cov.hat <- favre2 %*% vcov(model)[coeff.index, coeff.index] %*% t(favre2)
chisq.stat <- t(theta.hat)%*%solve(cov.hat)%*%theta.hat
1-pchisq(chisq.stat, df = 3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment