# R/bb.R In STFTS: Statistical Tests for Functional Time Series

#### Documented in dataset_bb

#' Integrals of Squared Brownian Bridge
#'
#' Generate a dataset of independent simulated values of \eqn{\int_0^1{B^2(t)}dt}, where \eqn{B} is a standard Brownian bridge on [0,1].
#'
#' @param NUM Number of simulated values generated in the dataset.
#' @return A vector with length equals to NUM.
#' @importFrom e1071 rwiener
#' @export
#' @examples
#' dataset_bb(10)

dataset_bb<-function(NUM){
bb<-rep(0,NUM)
for (i in 1:NUM){
W<-rwiener()
V<-W-(1:1000)*W[1000]/1000
bb[i]<-sum(V^2)/1000
}
return(bb)
}


## Try the STFTS package in your browser

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

STFTS documentation built on Aug. 19, 2021, 9:06 a.m.