R/cyclic.R

Defines functions cyclic_basis

### <FIXME> deriv? </FIXME>
cyclic_basis <- function(order, frequency, varname) {
    S <- 1:order * 2
    fm <- as.formula(paste("~ I(", rep(c("sin", "cos"), length(S)), "(",
                     rep(S, rep(2, length(S))), "* pi *", varname, "/", 
                     frequency, "))", collapse = "+"))
    return(as.basis(fm, remove_intercept = TRUE))
}

Try the basefun package in your browser

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

basefun documentation built on May 31, 2022, 3 a.m.