#glm(cbind(da,age, 6-damage) ~ temp, family = binomial, data = orings)

#when temperature increases by 1 degrees, then the log odds of o ring failure decrease by .2162
#When temoerature increases by 1 degrees, then the odds of o ring failure change by a multiplicative factor of exp(-.2162) = 80%
#ilogit() #Faraway, inverse-logit transformation

#glm(cbind(n. of successes, n. of failures))
#pval > alpha : Model doesn't exhibit lack of fit

F(x1, x2,…,xn) = (arithmetic mean, geometric mean, harmonic mean) GMDN = F(F(F(…F(x1, x2,…,xn))))

GMDN <- function(arr) {
  geothmetic <- c(mean(arr), exp(mean(log(arr))), length(arr)/sum(arr^(-1)))
  err <- range(geothmetic)[2] - range(geothmetic)[1]
  if (err < 0.00001)
    return(geothmetic)
  else
    return(GMDN(geothmetic))
}


GMDN(c(10, 20, 30, 40, 63.8355, 30, 30, 30, 30))
## [1] 28.28879 28.28879 28.28879