Learn R Programming

mixreg (version 2.0-10)

qqMix: Draw a normal quantile-quantile plot of the residuals from a fitted mixture of linear regressions.

Description

Draws a normal quantile-quantile plot using symbols whose sizes are proportional to the probabilities that the associated observations were generated by the associated components of the model.

Usage

qqMix(object, xlim=NULL, ylim=NULL,
      shape=c("disc","lozenge","square","none"), ngon=20, size=1, …)

Arguments

object

An object of class "mixresid", which consists of a list with entries providing the residuals, the relevant probabilities, the predictors, and the observations, as returned by residuals.mixreg(). When plotting against fitted values, it is probably better to used the standardized residuals, i.e. residuals.mixreg() should be called with std=TRUE.

xlim

A numeric vector of length two, giving the limits on the \(x\)-axis. Has the usual default.

ylim

A numeric vector of length two, giving the limits on the \(y\)-axis. Has the usual default.

shape

The shape of the plotting symbol. May be abbreviated to the first letter, i.e. "d", "l", "s", or "n". If shape is "none" then “ordinary” plotting is done, using the usual plotting symbols etc. This can be much faster, but somewhat defeats the purpose of this plotting function in that the resulting plots can be misleading. Using shape="n" allows the user to compare the misleading result with plots in which “improbable” residuals are downweighted,

ngon

The "disc" shape is actually a regular polygon; ngon specifies how many sides it should have; ignored if shape is not equal to "disc".

size

A scale factor to change the absolute sizes of the plotting symbols; values larger than 1 make the symbols larger than the default; values less than 1 make them smaller.

...

Additional arguments to be passed to the polygon function which actually draws the plotting symbols.

Value

None. This function is called for its side effect of drawing a normal quantile-quantile plot.

ACKNOWLEDGEMENT

The idea of creating residual plots for regression mixtures by making the symbol size proportional to the associated probability is due to Prof. Adrian Baddeley who was, at the time (2000) at the University of Western Australia. He is now (2021) at Curtin University.

Details

The plot produced is visually assessed by ignoring or discounting small symbols.

References

T. Rolf Turner (2000). Estimating the rate of spread of a viral infection of potato plants via mixtures of regressions. Applied Statistics 49 Part 3, pp. 371 -- 384.

See Also

ncMcTest(),cband(), covMix(), mixreg(), plot.cband(), plot.mixresid(), qqMix(), residuals.mixreg()

Examples

Run this code
# NOT RUN {
# Aphids.
    fita <- mixreg(plntsInf~aphRel,ncomp=2,seed=42,data=aphids)
    resa <- residuals(fita,std=TRUE)
    qqMix(resa,size=2,shape="l")
    qqMix(resa,shape="n",pch=7,cex=1.5)
# Kilns.
    thStrt <- list(list(beta=c(26.1,48800),sigsq=0.58,lambda=0.33333333),
                   list(beta=c(23.5,32400),sigsq=0.58,lambda=0.33333333),
                   list(beta=c(-0.06,20760),sigsq=0.58,lambda=0.33333333))
    fitk   <- mixreg(y ~ x,ncomp=3,data=kilnAoneOut,thetaStart=thStrt)
    
# }
# NOT RUN {
 # Takes too long
        resk   <- residuals(fitk,std=TRUE)
        qqMix(resk,shape="s")
        qqMix(resk,shape="s",xlim=c(-0.25,0.9),ylim=c(-3,3))
        qqMix(resk,shape="n")
    
# }

Run the code above in your browser using DataLab