R/fda.smoothdata.R

Defines functions fda.smoothdata

Documented in fda.smoothdata

fda.smoothdata <-
function(data, basistype="fourier", nbasis=9, norder=4){
	if(missing(data)) 
		stop("Missing data")
	
	mat <- data$mat
	cov <- data$cov
	L <- nrow(mat)
	
	if(tolower(basistype) == "fourier"){
		fbase <- fda::create.fourier.basis(rangeval=c(0, L), nbasis)
	}else if(tolower(basistype) == "bspline"){
		fbase <- fda::create.bspline.basis(rangeval=c(0, L), nbasis, norder)
	}else{
		stop("basistype must be 'fourier' or 'bspline'.")
	}
	
	fpar <- fda::fdPar(fbase) 
	fd <- fda::smooth.basis(1:L, mat, fpar)
	FD <- list(fd=fd, cov=cov)
	return(FD)
}

Try the Actigraphy package in your browser

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

Actigraphy documentation built on March 26, 2020, 6:07 p.m.