Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. taronesZStat <- function(model){
  2.  
  3. #Extracting model residuals
  4. res <- residuals(model)
  5.  
  6. #Number of residuals
  7. n <- length(res)
  8.  
  9. #Calculating Tarone's Z-statistic
  10. p_hat <- sum(res)/n
  11.  
  12. S <- sum((res - n * p_hat)^2 / (p_hat * (1 - p_hat)))
  13.  
  14. Z_score <- (S - sum(n)) / sqrt(2 * sum(n * (n - 1)))
  15.  
  16. return(Z_score)
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement