Description Details Author(s) Examples
A new diagnostic check for model adequacy in regression and generalized linear models is implemented.
Package: | hcc |
Type: | Package |
Version: | 0.54 |
Date: | 2013-03-23 |
License: | GPL (>=2) |
This package provides a new diagnostic test that will be discussed in a future paper.
Yun Shi and A.I. McLeod Maintainer: A. I. McLeod <aimcleod@uwo.ca>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #Example 1
#an example with hidden correlation
set.seed(313477)
data <- simer(50, 5)
ans <- lm(y~x, data=data)
summary(ans)
#the usual regression plots
par(mfrow=c(2,2))
plot(ans)
par(mfrow=c(1,1))
#hidden correlation signficance test
res <- resid(ans)
hctest(data$x, res)
#Poincare plot
PoincarePlot(data$x, res)
#residual dependency test
rdplot(data$x, res)
#Example 2
data(birthwt)
ans<-glm(low~., data=birthwt[,-10], family="binomial")
ans2<-step(ans)
#only lwt (mother's weight) is a numeric variable
res <- resid(ans2)
hctest(birthwt$lwt, res)
#the test for hidden correlation is signficant
PoincarePlot(birthwt$lwt, res)
#the Poincare plot confirms the lack of fit
rdplot(birthwt$lwt, res)
#the residual-dependency plot does not give a clear signal
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.