Learn R Programming

fANCOVA (version 0.5-1)

T.aov: Test the equality of nonparametric curves or surfaces based on an ANOVA-type statistic

Description

Test the equality of nonparametric curves or surfaces based on an ANOVA-type statistic. The specific model considered here is

y_ij= m_i(x_ij) + e_ij,

where m_i(.), are nonparametric smooth functions; e_ij are independent identically distributed errors. The errors e_ij do not have to be independent N(0, sigma^2) errors. The errors can be heteroscedastic, i.e., e_ij = sigma_i(x_ij) * u_ij, where u_ij are independent identically distributed errors with mean 0 and variance 1.

We are interested in the problem of testing the equality of the regression curves (when x is one-dimensional) or surfaces (when x is two-dimensional),

H_0: m_1(.) = m_2(.) = ... v.s. H_1: otherwise

The problem can also be viewed as the test of the equality in the one-sample problem for functional data.

Usage

T.aov(x, ...)
# S3 method for default
T.aov(x, y, group, B = 200, degree = 1, criterion = c("aicc", "gcv"), 
		family = c("gaussian", "symmetric"), tstat = c("DN", "YB"), 
		user.span = NULL, ...)

Arguments

x

a vector or two-column matrix of covariate values.

y

a vector of response values.

group

a vector of group indicators that has the same length as y.

B

the number of bootstrap replicates. Usually this will be a single positive integer.

degree

the degree of the local polynomials to be used. It can ben 0, 1 or 2.

criterion

the criterion for automatic smoothing parameter selection: ``aicc'' denotes bias-corrected AIC criterion, ``gcv'' denotes generalized cross-validation.

family

if ``gaussian'' fitting is by least-squares, and if ``symmetric'' a re-descending M estimator is used with Tukey's biweight function.

tstat

the test statistic used here: if ``DN'' Dette, H., Neumeyer, N. (2001)'s statistic is used; if ``YB'' Young, S.G. and Bowman, A.W. (1995)'s statistic is used.

user.span

The user-defined parameter which controls the degree of smoothing.

some control parameters can also be supplied directly

Value

An object of class ``fANCOVA''

Details

A wild bootstrap algorithm is applied to test the equality of nonparametric curves or surfaces based on an ANOVA-type statistic.

References

Dette, H., Neumeyer, N. (2001). Nonparametric analysis of covariance. Annals of Statistics. 29, 1361--1400.

Young, S.G. and Bowman, A.W. (1995). Nonparametric analysis of covariance. Biometrics. 51, 920--931.

Wang. X.F. and Ye, D. (2010). On nonparametric comparison of images and regression surfaces. Journal of Statistical Planning and Inference. 140, 2875--2884.

See Also

T.L2, T.var, loess.as, loess.ancova.

Examples

Run this code
# NOT RUN {
## Nonparametric test the equality of multiple regression curves
## Simulate data sets

n1 <- 100
x1 <- runif(n1,min=0, max=3)
sd1 <- 0.2
e1 <- rnorm(n1,sd=sd1)
y1 <- sin(2*x1) + e1

n2 <- 100
x2 <- runif(n2, min=0, max=3)
sd2 <- 0.25
e2 <- rnorm(n2, sd=sd2)
y2 <- sin(2*x2) + 1 + e2

n3 <- 120
x3 <- runif(n3, min=0, max=3)
sd3 <- 0.25
e3 <- rnorm(n3, sd=sd3)
y3 <- sin(2*x3)  + e3

data.bind <- rbind(cbind(x1,y1,1), cbind(x2,y2,2),cbind(x3,y3,3))
data.bind <- data.frame(data.bind)
colnames(data.bind)=c('x','y','group') 


t1 <- T.aov(data.bind$x, data.bind$y, data.bind$group)
t1
plot(t1)
plot(t1, test.statistic=FALSE)

########
## Nonparametric test the equality for regression surfaces
## Simulate data sets

n1 <- 100
x11 <- runif(n1,min=0, max=3)
x12 <- runif(n1,min=0, max=3)
sd1 <- 0.2
e1 <- rnorm(n1,sd=sd1)
y1 <- sin(2*x11) + sin(2*x12)  + e1

n2 <- 100
x21 <- runif(n2, min=0, max=3)
x22 <- runif(n2, min=0, max=3)
sd2 <- 0.25
e2 <- rnorm(n2, sd=sd2)
y2 <- sin(2*x21) + sin(2*x22) + 1 + e2

n3 <- 120
x31 <- runif(n3, min=0, max=3)
x32 <- runif(n3, min=0, max=3)
sd3 <- 0.25
e3 <- rnorm(n3, sd=sd3)
y3 <- sin(2*x31) + sin(2*x32) + e3

data.bind <- rbind(cbind(x11, x12 ,y1,1), cbind(x21, x22, y2,2),cbind(x31, x32,y3,3))
data.bind <- data.frame(data.bind)
colnames(data.bind)=c('x1','x2', 'y','group') 

T.aov(data.bind[,c(1,2)], data.bind$y, data.bind$group)
# }

Run the code above in your browser using DataLab