dispersion | R Documentation |
Calculate the dispersion of the residuals
dispersion(model)
model |
A fitted regression model (using gam, or bam). |
Numeric value: dispersion of the residuals.
Other Functions for model inspection:
fvisgam()
,
gamtabs()
,
inspect_random()
,
plot_data()
,
plot_parametric()
,
plot_smooth()
,
plot_topo()
,
pvisgam()
trial <- function(f=.95){ x <- rep(1-f,101) x[round(runif(1,1,50)):length(x)] <- f return(rbinom(101,1,x)) } set.seed(123) dat <- data.frame(Time=rep( seq(0,1,length=101),100), y = unlist(replicate(100, trial(f=1), simplify=FALSE)), stringsAsFactors=FALSE) # under dispersion: gam1 <- gam(y ~ s(Time), data=dat, family=binomial) summary(gam1) dispersion(gam1) # but not here: gam2 <- gam(y ~ 1, data=dat, family=binomial) summary(gam2) dispersion(gam2) # and not here: dat <- data.frame(Time=rep( seq(0,1,length=101),100), y = unlist(replicate(100, trial(f=.75), simplify=FALSE)), stringsAsFactors=FALSE) gam3 <- gam(y ~ s(Time), data=dat, family=binomial) summary(gam3) dispersion(gam3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.