tests/testthat/test-separation.R

if (FALSE) { ## useful to have it handy, but not useful to test on a routine basis
  cat("\ntest separation:")
  
  ## A set of 4 completely separated sample points ##
  x <- c(-2, -1, 1, 2)
  y <- c(0, 0, 1, 1)
  
  #safeBinaryRegression::glm(y ~ x, family = binomial())
  #stats::glm(y ~ x, family = binomial()) ## slightly cryptic warning!
  HLfit(y ~ x, family = binomial(), data=data.frame(x,y))
  
  
  ## A set of 4 quasicompletely separated sample points ##
  x <- c(-2, 0, 0, 2)
  y <- c(0, 0, 1, 1)
  
  #safeBinaryRegression::glm(y ~ x, family = binomial())
  #stats::glm(y ~ x, family = binomial()) ## detects nothing !
  HLfit(y ~ x, family = binomial(), data=data.frame(x,y)) # separation+non-convergence
}

Try the spaMM package in your browser

Any scripts or data that you put into this service are public.

spaMM documentation built on June 22, 2024, 9:48 a.m.