The procedure is based on the analysis of randomly chosen one-dimensional projections. The function tests ANOVA models for functional data with continuous covariates and perform special contrasts for the factors in the formula.
Usage
## S3 method for class 'RPm'
anova(object,formula,data.fac,RP=min(30,ncol(object)),
alpha=0.95,hetero=TRUE,pr=FALSE,w=rep(1,ncol(object)),
nboot=0,contrast=NULL,...)
Arguments
object
Functional response data. Object with class fdata with n curves discretizated in m points.
formula
as formula.
data.fac
Explanatory variables. Data frame with dimension (n x p), where p are the number of factors or covariate considered.
RP
Vector of random projections.
alpha
Alpha value, by defalult alpha=0.95.
hetero
=TRUE (by default) heteroskedastic ANOVA.
pr
If TRUE, print intermediate results.
w
Vector of weights.
nboot
Number of bootstrap samples, by defult no bootstrap sample, nboot=0.
contrast
List of special contrast to be used ; by default no special contrasts are used (contrast=NULL).
...
Further arguments passed to or from other methods.
Details
The function allows user-defined contrasts. The list of contrast to be used for some of the factors in the formula. Each contrast matrix in the list has r rows, where r is the number of factor levels. The user can also request special predetermined contrasts, for example using the contr.helmert, contr.sum or contr.treatment functions.
The function returns (by default) the significance of the variables using the Bonferroni test and the False Discovery Rate test.
Bootstrap procedure provides more precision
Value
Shows:
proj
The projection value of each point on the curves. Matrix with dimension (RP x m), where RP is the number of projection and m are the points observed in each projection curve.
mins
minimum number for each random projection.
result
p-value for each random projection.
test.Bonf
significance (TRUE or FALSE) for vector of random projections RP in columns and factor (and special contrast) by rows.
p.Bonf
p-value for vector of random projections RP in columns and factor (and special contrast) by rows.
test.fdr
False Discovery Rate (TRUE or FALSE) for vector of random projections RP in columns and factor (and special contrast) by rows.
p.fdr
p-value of False Discovery Rate for vector of random projections RP in columns and factor (and special contrast) by rows.
test.Boot
False Discovery Rate (TRUE or FALSE) for vector of random projections RP in columns and factor (and special contrast) by rows.
p.Boot
p-value of Bootstrap sambple for vector of random projections RP in columns and factor (and special contrast) by rows.
Note
If hetero=TRUE then all factors must be categorical.
Author(s)
Juan A. Cuesta-Albertos, Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es
References
Cuesta-Albertos, J.A., Febrero-Bande, M. A simple multiway ANOVA for functional data.
Test 2010, DOI 10.1007/s11749-010-0185-3.
See Also
See Also as: anova.onefactor
Examples
# ex anova.hetero
data(phoneme)
names(phoneme)
data=as.data.frame(phoneme$learn[["data"]])
group=phoneme$classlearn
n=nrow(data)
group.rand=as.factor(sample(rep(1:3,len=n),n))
RP=c(2,5,15,30)
#ex 1: real factor and random factor
m03=data.frame(group,group.rand)
resul1=anova.RPm(data,~group+group.rand,m03,RP=c(5,30))
summary.anova(resul1)
#ex 2: real factor with special contrast
m0=data.frame(group)
cr5=contr.sum(5) #each level vs last level
resul03c1=anova.RPm(data,~group,m0,contrast=list(group=cr5))
summary.anova(resul03c1)
#ex 3: random factor with special contrast
m0=data.frame(group.rand)
cr3=contr.sum(3) #each level vs last level
resul03c1=anova.RPm(data,~group.rand,m0,contrast=list(group.rand=cr3))
summary.anova(resul03c1)