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.
Arguments
- object
Functional response data. Object with class fdata with
n
curves discretizated inm
points. For multivariate problemsobject
can be adata.frame
or amatrix
- formula
as formula without response.
- data.fac
Explanatory variables. Data frame with dimension (
n
xp
), wherep
are the number of factors or covariates considered.- RP
Vector of number of random projections.
- alpha
Confidence level, by default
alpha
=0.95.- zproj
Function for generating the projections or an object that contains that projections.
- par.zproj
List of parameters for
zproj
function.- hetero
logical
. IfTRUE
(by default) means heteroskedastic ANOVA.- pr
logical
. IfTRUE
prints intermediate results.- w
Vector of weights (only for multivariate problems).
- nboot
Number of bootstrap samples, by default no bootstrap computations,
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.
- ndec
Number of decimals.
Value
An object with the following components:
proj
: The projection value of each point on the curves. Matrix with dimensions (RP
xm
), whereRP
is the number of projections andm
is the number of 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 projectionsRP
in columns and factors (and special contrasts) in rows.p.Bonf
: p-value for vector of random projectionsRP
in columns and factors (and special contrasts) in rows.test.fdr
: False Discovery Rate (TRUE or FALSE) for vector of random projectionsRP
in columns and factors (and special contrasts) in rows.p.fdr
: p-value of False Discovery Rate for vector of random projectionsRP
in columns and factors (and special contrasts) in rows.test.Boot
: False Discovery Rate (TRUE or FALSE) for vector of random projectionsRP
in columns and factors (and special contrasts) in rows.p.Boot
: p-value of Bootstrap sample for vector of random projectionsRP
in columns and factors (and special contrasts) in rows.
Details
zproj
allows to change the generator process of the projections. This
can be done through the inclusion of a function or a collection of
projections generated outside the function. By default, for a functional
problem, the function rproc2fdata
is used. For multivariate problems,
if no function is included, the projections are generated by a normalized
gaussian process of the same dimension as object
. Any user function
can be included with the only limitation that the two first parameters are:
n
: number of projectionst
: discretization points for functional problemsm
: number of columns for multivariate problems.
That functions must return a fdata
or matrix
object
respectively.
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
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: fanova.onefactor
Author
Juan A. Cuesta-Albertos, Manuel Febrero-Bande, Manuel Oviedo de la
Fuente
manuel.oviedo@udc.es
Examples
if (FALSE) { # \dontrun{
# ex fanova.hetero
data(phoneme)
names(phoneme)
# A MV matrix obtained from functional data
data=as.data.frame(phoneme$learn$data[,c(1,seq(0,150,10)[-1])])
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=fanova.RPm(phoneme$learn,~group+group.rand,m03,RP=c(5,30))
summary(resul1)
#ex 2: real factor with special contrast
m0=data.frame(group)
cr5=contr.sum(5) #each level vs last level
resul03c1=fanova.RPm(data,~group,m0,contrast=list(group=cr5))
summary(resul03c1)
#ex 3: random factor with special contrast. Same projs as ex 2.
m0=data.frame(group.rand)
zz=resul03c1$proj
cr3=contr.sum(3) #each level vs last level
resul03c1=fanova.RPm(data,~group.rand,m0,contrast=list(group.rand=cr3),zproj=zz)
summary(resul03c1)
} # }