Description Usage Arguments Details Value Side Effects Warning Author(s) References See Also Examples
Produces confidence and prediction bands, two-sided or upper or lower, for the lines fitted in a model consisting of a mixture of one-variable regressions.
1 |
object |
Object describing the fitted mixture of regressions, as returned
by |
alpha |
One minus the confidence level for the confidence and prediction bands; e.g. alpha = 0.05 for 95% confidence. |
MC |
Logical scalar; should the covariance matrix of the parameter estimates
be calculated by a Monte Carlo procedure? If the covariance matrix
is extracted from |
xlen |
The number of points to be plotted in the band envelopes. The x-values of the points will be equispaced from the minimum to the maximum of the predictor variable. |
plot |
Logical scalar; should a plot of the fitted model and confidence and prediction bands be produced immediately? |
... |
Extra arguments to be passed to |
The prediction bands are conditional in that the associated probability is conditional upon the associated observation being generated by the relevant component of the mixture.
The covariance matrix need to construct the confidence and prediction
bands is extracted from object
, given that object
has
an entry named "covMat"
(i.e. if the call to mixreg
that produced
object
was made with covMat=TRUE
). If object
has no such entry then covMix()
is called to produce the covariance
matrix. (Such a call may take a bit of time.)
An object of class "cband"
, consisting of a list with entries:
theta |
The parameter list from object (as returned by mixreg). |
intercept |
The logical value from object indicating whether intercepts were fitted. |
x |
The predictor for the model (extracted from the |
y |
The response for the model (extracted from the |
xf |
The equispaced sequence of values, extending from |
bnds |
A list with one entry for each component of the mixture. Each entry is a matrix with 8 columns (lower and upper confidence and prediction bounds for one-sided intervals and lower and upper confidence and prediction bounds for two-sided interval). |
alpha |
Numeric scalar; the |
varnms |
Character vector of length two providing the names of the predictor (first entry) and of the response (second entry). |
If plot
is TRUE
the value is returned invisibly.
If plot
is TRUE
a plot of the fit and the confidence
and prediction bands is produced in whatever device is currently
open or on screen if no device is open.
If MC
is FALSE
then an error may be thrown if
the observed Fisher information (the inverse of which is use
as the estimated covariance matrix) is singular. Note that
if MC
is FALSE then any call to covMix()
is
made with useMC="no"
.
Rolf Turner r.turner@auckland.ac.nz
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.
ncMcTest()
, covMix()
,
mixreg()
, plot.cband()
,
residuals.mixreg()
, plot.mixresid()
,
qqMix()
,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Aphids.
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=TRUE)
plot(cbds) # Same plot as was produced by call to cband().
# Kilns.
thStrt <- list(
list(beta=c(26.07,48808),sigsq=1.1573,lambda=0.33333333),
list(beta=c(23.48,32387),sigsq=1.8730,lambda=0.33333333),
list(beta=c(-0.0597,20760),sigsq=0.2478,lambda=0.33333333)
)
fit <- mixreg(y ~ x,ncomp=3,data=kilnAoneOut,thetaStart=thStrt)
## Not run: # Takes too long.
res <- residuals(fit,std=TRUE)
qqMix(res) # No way are these residuals Gaussian!
cbdsG <- cband(fit)
cbdsMC <- cband(fit,MC=TRUE)
plot(cbdsG)
plot(cbdsMC)
# Same-same, despite the lack of Gaussianity!
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.