cplot {merror} | R Documentation |
Scatter plot of observations for a pair of devices with calibration curve.
Description
Creates a scatter plot for any pair of observations in the data.frame and superimposes the calibration curve.
Usage
cplot(df, i, j, leg.loc="topleft", regress=FALSE, lw=1, t.size=1, alpha.beta.sigma=NULL)
Arguments
df |
n (no. of items) x N (no. of methods) matrix or data.frame containing the measurements. N must be >= 3 and n > N. |
i |
Select column i for device i. |
j |
Select column j for device j not equal to i. |
leg.loc |
Location of the legend. |
regress |
If TRUE, add both naive regression lines (for comparison only). |
lw |
Line widths. |
t.size |
Text size. |
alpha.beta.sigma |
By default, |
Details
By default, cplot
displays the corresponding calibration curve for
devices i and j based on the parameter estimates for alpha, beta, and sigma computed
using ncb.od
. You can overide this calibration curve by providing argument
alpha.beta.sigma with different estimates. Both naive regression lines (device i
regressed on device j, and device j regressed on device i) by setting "regress=TRUE".
Note, however, that the calibration curve will fall somewhere between these two
regression lines, depending on the the ratio of the imprecision standard deviations
(sigmas). (This may not hold if there are missing measurement data values given that ordinary regression requires deleting any item with one or more missing values.)
Value
Produces a scatter plot with the calibration curve and titles that includes the calibration equation and the scale-bias adjusted imprecision standard deviations.
Author(s)
Richard A. Bilonick
References
Jaech, J. L. (1985) Statistical Analysis of Measurement Errors. New York: Wiley.
See Also
Examples
library(merror)
data(pm2.5)
# Make various calibration plots for pm2.5 measurements
par(mfrow=c(2,2))
cplot(pm2.5,2,1)
cplot(pm2.5,3,1)
cplot(pm2.5,4,1)
# Add the naive regression lines JUST for comparison
cplot(pm2.5,5,1,regress=TRUE,t.size=0.9)
# This is redundant but illustrates using the
# argument alpha.beta.sigma
a <- ncb.od(pm2.5)$sigma.table$alpha.ncb[1:5]
b <- ncb.od(pm2.5)$sigma.table$beta[1:5]
s <- ncb.od(pm2.5)$sigma.table$sigma[1:5]
alpha.beta.sigma <- t(data.frame(a,b,s))
cplot(pm2.5,2,1,alpha.beta.sigma=alpha.beta.sigma)
cplot(pm2.5,2,1,alpha.beta.sigma=alpha.beta.sigma,regress=TRUE)
data(pm2.5)
## Not run:
# Use omx function to specify the data for alpha.beta.sigma
pm <- pm2.5
# omx uses OpenMx which does not like periods in data column names
names(pm) <- c('ms_conc_1','ws_conc_1','ms_conc_2','ws_conc_2','frm')
# Fit one-factor measurement error model with FRM sampler as reference
omxfit <- omx(data=pm[,c(5,1:4)],bs.q=c(0.025,0.5,0.975),reps=100)
# Make a calibration plot using the results from omx instead of the default ncb.od
cplot(pm[,c(5,1:4)],1,2,alpha.beta.sigma=omxfit$abs)
## End(Not run)