plot.cband: Plot confidence bands for a mixture of regressions.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plot.cband.R

Description

Plots the fitted lines and confidence and prediction bands as calculated by cband, for a mixture of regressions on one variable.

Usage

1
2
3
4
## S3 method for class 'cband'
plot(x, cbands=TRUE, pbands=TRUE,
                     type=c("both","upper","lower"),
                     legPos="topleft", sepFac=0.8, ...)

Arguments

x

An object of class "cband" specifying the fitted lines and confidence and prediction bands to be plotted, as produced by cband.

cbands

Logical scalar; should the confidence bands be plotted?

pbands

Logical scalar; should the prediction bands be plotted?

type

Character string specifying whether the bands plotted should be two-sided ("both") or if only the upper ("upper" or lower ("lower") envelopes should be plotted. May be abbreviated (e.g. to "b", "u" or "l").

legPos

A list with entries x and y, or a text string, specifying the placement of the legend. See legend() for details. The plotting of a legend may be suppressed legPos=NULL. The legend consists of two parts; the upper part, which specifies line types, will have an entry for confidence bands only if cbands is TRUE and likewise it will have an entry type for prediction bands only if pbands is TRUE. The lower part specifies the colours of the fitted lines corresponding to the different components. It will be present only if there is more than one colour for the components.

sepFac

“Separation factor”. A numeric scalar determining the amount of separation between the two parts of the legend (see above). Has an effect only if both parts of the legend are present. Making sepFac larger increases the amount of separation between the two parts; making it smaller decreases the amount. Making it much smaller than the default value will cause over-printing.

...

Optional extra arguments for plot(), points() and lines(). These may include xlim, ylim, xlab, ylab, lty, col, pch, and main. If col is supplied, its first entry determines the colour in which the points are plotted, and the remaining entries of col determine the colours in which the fitted lines and envelopes (corresponding to the different components) are plotted. Note that col is replicated to have length K+1 where K is the number of components in the model. The argument lty determines the line types for the fitted lines, the confidence envelopes and the prediction envelopes. These line types remain constant across components. Note that if main is not supplied then a “sensible” default main title is created. If no main title is desired, specify main="".

Details

This function is a method for plot. Note that a simple plot of the fit may be produced by calling plot(object) where object is an object of class "mixreg" and the x argument of this function was produced by applying cband() to this object.

Value

None. This function is called for its side effect of producing a plot.

Author(s)

Rolf Turner r.turner@auckland.ac.nz

See Also

cband(), plot.cint(), plot.mixreg(), plot.mixresid(), qqMix(), residuals.mixreg()

Examples

1
2
3
4
5
6
7
8
    thStrt <- list(list(beta=c(3.0,0.1),sigsq=16,lambda=0.5),
                   list(beta=c(0.0,0.0),sigsq=16,lambda=0.5))
    fit    <- mixreg(plntsInf~aphRel,ncomp=2,thetaStart=thStrt,
                     covMat=TRUE,data=aphids)
    cbds   <- cband(fit)
    plot(cbds)
    plot(cbds,pbands=FALSE)
    plot(cbds,pbands=FALSE,type="u")

mixreg documentation built on Oct. 14, 2021, 9:12 a.m.