Description Usage Arguments Details See Also Examples
This function tests the equality of nonparametric curves and surface estimations based on L2 distance. The specific model considered here is
1 2 3 |
formula |
A regression formula. This is like the formula for a lm. |
test |
An indicator of variable for testing nonparametric curves or surface estimations |
data |
A data frame or list containing the model response variable and covariates required by the formula. |
N.boot |
the number of bootstrap replicates. This should 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. |
m |
the number of the sampling points for the Monte-Carlo integration. |
user.span |
the user-defined parameter which controls the degree of smoothing. |
... |
other options from “loess” package. |
y_ij= m_i(x_ij) + e_ij,
where m_i(.), are semiparametric smooth functions; e_ij are subject-specific 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.
A bootstrap algorithm is applied to test the equality of semiparametric curves or surfaces based on L2 distance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | n1 <- 200
x1 <- runif(n1,min=0, max=3)
sd1 <- 0.2
e1 <- rnorm(n1,sd=sd1)
y1 <- sin(2*x1) + cos(2*x1) + e1
n2 <- 120
x2 <- runif(n2, min=0, max=3)
sd2 <- 0.25
e2 <- rnorm(n2, sd=sd2)
y2 <- sin(2*x2) + cos(2*x2) + x2 + e2
dat <- data.frame(rbind(cbind(x1,y1,1), cbind(x2,y2,2)))
colnames(dat)=c('x','y','group')
t1 <- T.L2c(formula=y~x,test=~group,data=dat)
t1$p.value
########
## Semiparametric test the equality for regression surfaces
## Simulate data sets
n1 <- 200
x11 <- runif(n1,min=0, max=3)
x12 <- runif(n1,min=0, max=3)
sd1 <- 0.2
e1 <- rnorm(n1,sd=sd1)
y1 <- 2*x11^2 + 3*x12^2 + e1
n2 <- 120
x21 <- runif(n2, min=0, max=3)
x22 <- runif(n2, min=0, max=3)
sd2 <- 0.25
e2 <- rnorm(n2, sd=sd2)
y2 <- 2*x21^2 + 3*x22^2 + sin(2*pi*x21) + e2
n3 <- 150
x31 <- runif(n3,min=0, max=3)
x32 <- runif(n3,min=0, max=3)
sd3 <- 0.2
e3 <- rnorm(n3,sd=sd1)
y3 <- 2*x31^2 + 3*x32^2 + e3
data.bind <- data.frame(rbind(cbind(x11, x12 ,y1,1), cbind(x21, x22, y2,2), cbind(x31, x32, y3,3)))
colnames(data.bind)=c('x1','x2', 'y','group')
T.L2c(formula=y~x1+x2,test=~group,data=data.bind)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.