Description Usage Arguments Details Value Author(s) References See Also Examples
Main test routine for formally testing the equality of two curves represented by discrete data points over a domain with homoscedacity or heteroscedacity errors. curvetest is the wrapper of curvetest.raw.
1 2 3 4 | curvetest(formula, data1 = NULL, data2 = NULL, equal.var = TRUE, alpha = 0.5, bw = NULL, plotit = TRUE, conf.level = 0.05, kernel = c("Triangle", "Gaussian", "Trio", "Uniform", "Triweight", "Epanechnikov", "Quartic"), nn = 100, myx = NULL, bcorrect = "simple",...)
curvetest.raw(fits1, fits2, equal.var, conf.level, plotit)
## S3 method for class 'curvetest'
print(x,...)
|
formula |
A formula to the data set such as y~x. |
data1 |
A data frame of 2 columns representing the underlying curve 1. The column names must agree with the names in formula. |
data2 |
A data frame for curve 2. If it is NULL, the test is whether curve 1 is statistically equal to 0 over the defining domain. |
equal.var |
Whether the variances are equal. Default to TRUE. |
alpha |
Smoothing parameter. |
bw |
Window bandwidth for both curves. |
plotit |
WHether plot the fitted curves or not. Default: FALSE. |
conf.level |
The confidence level to claim the curves are different. Default: 0.05. |
kernel |
One of the kernel functions to use to fit the curves. Must be one of "Triangle", "Gaussian", "Trio","Uniform", "Triweight", "Epanechnikov", "Quartic". partial match is allowed. |
nn |
Number of data points in the test domain to calculate the curve values. |
myx |
x-values in the test domain to calculate the curve values. If it is specified, nn will be suppressed. |
bcorrect |
Boundary correction method. Right now, except for 'none', meaning no corrections, the only other opton is 'simple'. |
... |
When plotit is true, plot parameters can be specified such as pch, lty, col etc. |
fits1,fits2 |
The fitted results from fitting the first or second curve by curvefit procedure. |
x |
Test results from curvetest. |
The algorithm works by first fitting the curves using local regression method specified by formula on data1 and/or data 2 with smoothing parameters specified in the function calls. Then it will test on the fitted curve 1 and curve 2 to see if they are statistically equal or not.
An R object of class curvetest will be generatd, containing curve fitting and testing results.
Statistic,p |
Test statistic and p value of testing whether $f_1(x)==f_2(x)$ or $f_1(x)==0$. |
eDF |
Estimated degree of freedom of the fitting. |
equal.var |
The model specification of whether the two variances are equal or not |
esigma1,esigma2 |
Estimated varaince of the fitted curves. |
k0 |
The calculated value from the tube. See detail in paper. |
fits1,fits2 |
Objects of class 'curvefit' from curvefit ruotine. |
Zhongfa Zhang, Jiayang Sun
Zhongfa Zhang, et al: Test Equality of Curves with Homoscedastic or Heteroscedastic Errors. To appear
curvefit, print.curvetest, plot.curvetest
1 2 3 4 5 6 7 8 | n1=150; n2=155 ##numbers of data points for the two curves.
f1<-f2<-function(x){x*(1-x)+sin(2*pi*x)}; ##True functions.
x1=seq(0,1, length=n1);
x2=seq(0, 1, length=n2);
y1=f1(x1)+rnorm(n1, 0, 0.2)
y2=f2(x2)+rnorm(n2, 0, 0.2) ###Measured data for the two curves with noises.
curvetest(y~x,data.frame(x=x1,y=y1), data.frame(x=x2,y=y2), alpha = 0.7, equal.var=TRUE,plotit=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.