R/globalFstat.R

Defines functions globalFstat

Documented in globalFstat

#' An internal function used in bootstrap global F test
#' @name globalFstat
#' @keywords internal
globalFstat <- function(xfit, Qobs, t_vec) {

        Qmat_lm <- stats::lm(Qobs ~ xfit)
        Qfitted = fitted(Qmat_lm)
        n = nrow(Qobs)
        Qmean = colMeans(Qobs)
        ssr = sum(sapply(1:n, function(i) fdapace::trapzRcpp(t_vec, (Qmean - Qfitted[i, ])^2)))
        return(ssr)
}

Try the WRI package in your browser

Any scripts or data that you put into this service are public.

WRI documentation built on July 9, 2022, 1:06 a.m.