SHARE
TWEET

Untitled

a guest Jun 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require(lmtest)
  2. require(splines)
  3. x=rnorm(20 ,0,1)
  4. y=rep(c(0,1),times=10)
  5.      
  6. fit1=glm(y~x ,family = "binomial")
  7.      
  8. fit2=glm(y~ns(x,df=2) ,family = "binomial")
  9.      
  10. Model 1: y ~ x
  11. Model 2: y ~ ns(x, df = 2)
  12.   #Df  LogLik Df  Chisq Pr(>Chisq)
  13. 1   2 -12.952                    
  14. 2   3 -12.757  1 0.3912     0.5317
  15.      
  16. summary(fit1)
  17.  
  18. Coefficients:
  19.             Estimate Std. Error z value Pr(>|z|)
  20. (Intercept)   0.2367     0.4987   0.475    0.635
  21. x            -1.1804     0.9331  -1.265    0.206
  22.  
  23. (Dispersion parameter for binomial family taken to be 1)
  24.  
  25.     Null deviance: 27.726  on 19  degrees of freedom
  26. Residual deviance: 25.904  on 18  degrees of freedom
  27. AIC: 29.904
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top