R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("far-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('far') Loading required package: nlme far library : Modelization for Functional AutoRegressive processes version 0.6-0 (2005-01-10) > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "BaseK2BaseC" > > ### * BaseK2BaseC > > flush(stderr()); flush(stdout()) > > ### Name: BaseK2BaseC > ### Title: Changing Basis > ### Aliases: BaseK2BaseC > ### Keywords: algebra > > ### ** Examples > > data1 <- BaseK2BaseC(x=matrix(rnorm(50),ncol=5,nrow=10), nb=5) > multplot(data1,whole=TRUE) > > > > cleanEx(); ..nameEx <- "base.simul.far" > > ### * base.simul.far > > flush(stderr()); flush(stdout()) > > ### Name: base.simul.far > ### Title: Creating functional basis > ### Aliases: base.simul.far > ### Keywords: algebra > > ### ** Examples > > print(temp<-base.simul.far(10,3)) [,1] [,2] [,3] [1,] 0.0000000 0.000000e+00 0.0000000 [2,] 0.3090170 5.877853e-01 0.8090170 [3,] 0.5877853 9.510565e-01 0.9510565 [4,] 0.8090170 9.510565e-01 0.3090170 [5,] 0.9510565 5.877853e-01 -0.5877853 [6,] 1.0000000 1.224647e-16 -1.0000000 [7,] 0.9510565 -5.877853e-01 -0.5877853 [8,] 0.8090170 -9.510565e-01 0.3090170 [9,] 0.5877853 -9.510565e-01 0.9510565 [10,] 0.3090170 -5.877853e-01 0.8090170 > print(t(temp)%*%temp) [,1] [,2] [,3] [1,] 5.000000e+00 -2.599907e-16 -3.324367e-17 [2,] -2.599907e-16 5.000000e+00 3.557447e-17 [3,] -3.324367e-17 3.557447e-17 5.000000e+00 > matplot(base.simul.far(100,5),type='l') > > > > cleanEx(); ..nameEx <- "coef.far" > > ### * coef.far > > flush(stderr()); flush(stdout()) > > ### Name: coef.far > ### Title: Extract Model Coefficients > ### Aliases: coef.far > ### Keywords: algebra > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Modelization of the FARX process (joined and separate) > model1 <- far(data1,kn=4,joined=TRUE) > model2 <- far(data1,kn=c(3,1),joined=FALSE) > > # Calculation of the theoretical coefficients > coef.theo <- theoretical.coef(m=10,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Joined coefficient > round(coef(model1),2) [,1] [,2] [,3] [,4] [1,] 0.71 0.12 0.09 -0.08 [2,] -0.32 0.16 -0.10 -0.07 [3,] -0.02 -0.09 0.87 0.02 [4,] 0.00 0.00 0.00 0.25 > coef.theo$rho.T [,1] [,2] [,3] [,4] [1,] 0.672 -0.134 0.0 0.00 [2,] 0.366 0.228 0.0 0.00 [3,] 0.000 0.000 0.9 0.00 [4,] 0.000 0.000 0.0 0.34 > > # Separate coefficient > round(coef(model2),2) [,1] [,2] [,3] [,4] [1,] 0.41 0.09 0.01 -0.52 [2,] 0.04 0.88 0.02 0.03 [3,] 0.00 0.00 0.25 0.00 [4,] -0.08 -0.05 0.10 0.45 > coef.theo$rho.X.Z [,1] [,2] [,3] [,4] [1,] 0.45 0.0 0.00 0.50 [2,] 0.00 0.9 0.00 0.00 [3,] 0.00 0.0 0.34 0.00 [4,] 0.00 0.0 0.00 0.45 > > > > cleanEx(); ..nameEx <- "date.fdata" > > ### * date.fdata > > flush(stderr()); flush(stdout()) > > ### Name: date.fdata > ### Title: Extract the date of fdata > ### Aliases: date.fdata > ### Keywords: ts misc > > ### ** Examples > > # Reading the data > library(stats) > data(UKDriverDeaths) > > # Conversion of the data > fUKDriverDeaths <- as.fdata(UKDriverDeaths,col=1,p=12,dates=1969:1984, + name="UK Driver Deaths") > date.fdata(fUKDriverDeaths) [1] "1969" "1970" "1971" "1972" "1973" "1974" "1975" "1976" "1977" "1978" [11] "1979" "1980" "1981" "1982" "1983" "1984" > > > > cleanEx(); ..nameEx <- "fapply" > > ### * fapply > > flush(stderr()); flush(stdout()) > > ### Name: fapply > ### Title: Apply functions over a fdata object > ### Aliases: fapply > ### Keywords: univar > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > fapply(data1,sum) Functionnal data Variable(s): X Z Number of points per observation: 1 1 Number of observations: 400 > multplot(fapply(fapply(data1,abs),cumsum)) > > > > cleanEx(); ..nameEx <- "far" > > ### * far > > flush(stderr()); flush(stdout()) > > ### Name: far > ### Title: FARX(1) model estimation > ### Aliases: far plot.far print.far > ### Keywords: models ts > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Cross validation (joined and separate) > model1.cv <- far.cv(data=data1, y="X", x="Z", kn=8, ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=TRUE) > model2.cv <- far.cv(data=data1, y="X", x="Z", kn=c(4,4), ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=FALSE) > print(model1.cv) $cv k1 L1 L2 Linf L1max L2max Linfmax [1,] 1 0.5440224 0.6181106 0.9675649 0.4057501 0.4915427 0.9286690 [2,] 2 0.5262087 0.6053697 0.9348789 0.4444624 0.5440946 0.9952749 [3,] 3 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 [4,] 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [5,] 5 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [6,] 6 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [7,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [8,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minLinf k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL1max k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2max k1 L1 L2 Linf L1max L2max Linfmax [1,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 L1 L2 Linf L1max L2max Linfmax 8.0000000 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > print(model2.cv) $cv k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 1 1 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [2,] 1 2 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [3,] 1 3 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [4,] 1 4 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [5,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [6,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [7,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [8,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [9,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [10,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [11,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [12,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [13,] 4 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [14,] 4 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [15,] 4 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [16,] 4 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minLinf k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL1max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > k1 <- model1.cv$minL2[1] > k2 <- model2.cv$minL2[1:2] > > # Modelization of the FARX process (joined and separate) > model1 <- far(data=data1, y="X", x="Z", kn=k1, + center=FALSE, na.rm=FALSE, joined=TRUE) > model2 <- far(data=data1, y="X", x="Z", kn=k2, + center=FALSE, na.rm=FALSE, joined=FALSE) > print(model1) Functional Autoregressive Model Call: far(data = data1, y = "X", x = "Z", kn = k1, center = FALSE, na.rm = FALSE, joined = TRUE) Joined variable Dimension of the subspace: 3 Explained Variance: 99.97 % Estimated first Eigen values of the Covariance: 0.3878 0.2165 0.1093 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [1,] 0.606 -0.059 0.056 [2,] -0.200 0.439 -0.037 [3,] -0.001 -0.045 0.887 > print(model2) Functional Autoregressive Model Call: far(data = data1, y = "X", x = "Z", kn = k2, center = FALSE, na.rm = FALSE, joined = FALSE) Variable: X Dimension of the subspace: 2 Explained Variance: 99.92 % Estimated first Eigen values of the Covariance: 0.5118 0.2187 Variable: Z Dimension of the subspace: 2 Explained Variance: 100 % Estimated first Eigen values of the Covariance: 6.968e-01 1.453e-16 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [,4] [1,] 0.587 0.065 -0.209 0 [2,] 0.043 0.886 0.031 0 [3,] -0.069 -0.023 0.458 0 [4,] 0.000 0.000 0.000 0 > > > > cleanEx(); ..nameEx <- "far.cv" > > ### * far.cv > > flush(stderr()); flush(stdout()) > > ### Name: far.cv > ### Title: Cross Validation for FARX(1) model > ### Aliases: far.cv > ### Keywords: ts models > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Cross validation (joined and separate) > model1.cv <- far.cv(data=data1, y="X", x="Z", kn=8, ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=TRUE) > model2.cv <- far.cv(data=data1, y="X", x="Z", kn=c(4,4), ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=FALSE) > print(model1.cv) $cv k1 L1 L2 Linf L1max L2max Linfmax [1,] 1 0.5440224 0.6181106 0.9675649 0.4057501 0.4915427 0.9286690 [2,] 2 0.5262087 0.6053697 0.9348789 0.4444624 0.5440946 0.9952749 [3,] 3 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 [4,] 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [5,] 5 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [6,] 6 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [7,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [8,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minLinf k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL1max k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2max k1 L1 L2 Linf L1max L2max Linfmax [1,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 L1 L2 Linf L1max L2max Linfmax 8.0000000 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > print(model2.cv) $cv k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 1 1 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [2,] 1 2 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [3,] 1 3 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [4,] 1 4 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [5,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [6,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [7,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [8,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [9,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [10,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [11,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [12,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [13,] 4 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [14,] 4 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [15,] 4 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [16,] 4 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minLinf k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL1max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > k1 <- model1.cv$minL2[1] > k2 <- model2.cv$minL2[1:2] > > # Modelization of the FARX process (joined and separate) > model1 <- far(data=data1, y="X", x="Z", kn=k1, + center=FALSE, na.rm=FALSE, joined=TRUE) > model2 <- far(data=data1, y="X", x="Z", kn=k2, + center=FALSE, na.rm=FALSE, joined=FALSE) > print(model1) Functional Autoregressive Model Call: far(data = data1, y = "X", x = "Z", kn = k1, center = FALSE, na.rm = FALSE, joined = TRUE) Joined variable Dimension of the subspace: 3 Explained Variance: 99.97 % Estimated first Eigen values of the Covariance: 0.3878 0.2165 0.1093 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [1,] 0.606 -0.059 0.056 [2,] -0.200 0.439 -0.037 [3,] -0.001 -0.045 0.887 > print(model2) Functional Autoregressive Model Call: far(data = data1, y = "X", x = "Z", kn = k2, center = FALSE, na.rm = FALSE, joined = FALSE) Variable: X Dimension of the subspace: 2 Explained Variance: 99.92 % Estimated first Eigen values of the Covariance: 0.5118 0.2187 Variable: Z Dimension of the subspace: 2 Explained Variance: 100 % Estimated first Eigen values of the Covariance: 6.968e-01 1.453e-16 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [,4] [1,] 0.587 0.065 -0.209 0 [2,] 0.043 0.886 0.031 0 [3,] -0.069 -0.023 0.458 0 [4,] 0.000 0.000 0.000 0 > > > > cleanEx(); ..nameEx <- "fdata" > > ### * fdata > > flush(stderr()); flush(stdout()) > > ### Name: fdata > ### Title: Functional Data class > ### Aliases: as.fdata as.fdata.default as.fdata.matrix as.fdata.list fdata > ### print.fdata summary.fdata print.summary.fdata > ### Keywords: ts misc > > ### ** Examples > > # Reading of the data > library(stats) > data(UKDriverDeaths) > > # Making the data of class 'fdata' > fUKDriverDeaths <- as.fdata(UKDriverDeaths,col=1,p=12,dates=1969:1984, + name="UK Driver Deaths") > summary(fUKDriverDeaths) Variable: UK Driver Deaths Mean of the norms: L1 norm L2 norm Linf norm 1670.307 1685.357 2134.375 > > # ploting of the data : whole and 1 year > par(mfrow=c(2,1)) > plot(fUKDriverDeaths,xval=1969+(1:192)/12,whole=TRUE, + name="Whole Evolution : ") > plot(fUKDriverDeaths,date="1984",xval=1:12, + name="Evolution during year 1984 : ") > > # Matrix conversion > print(as.fdata(matrix(rnorm(50),10,5))) Functionnal data Variable(s): var Number of points per observation: 10 Number of observations: 5 > print(as.fdata(matrix(rnorm(500),100,5),col=1:2,p=5)) Functionnal data Variable(s): 1 2 Number of points per observation: 5 5 Number of observations: 20 > > # List Conversions > print(as.fdata(list("X"=matrix(rnorm(100),10,10), + "Z"=matrix(rnorm(50),5,10)))) Functionnal data Variable(s): X Z Number of points per observation: 10 5 Number of observations: 10 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "interpol.matrix" > > ### * interpol.matrix > > flush(stderr()); flush(stdout()) > > ### Name: interpol.matrix > ### Title: Interpolation matrix > ### Aliases: interpol.matrix > ### Keywords: algebra > > ### ** Examples > > mat1 <- interpol.matrix(12,24) > mat2 <- interpol.matrix(c(3,5),c(12,12)) > print(mat1 %*% base.simul.far(24,5)) [,1] [,2] [,3] [,4] [,5] [1,] 0.1305262 0.2588190 0.3826834 0.5 0.6087614 [2,] 0.3826834 0.7071068 0.9238795 1.0 0.9238795 [3,] 0.6087614 0.9659258 0.9238795 0.5 -0.1305262 [4,] 0.7933533 0.9659258 0.3826834 -0.5 -0.9914449 [5,] 0.9238795 0.7071068 -0.3826834 -1.0 -0.3826834 [6,] 0.9914449 0.2588190 -0.9238795 -0.5 0.7933533 [7,] 0.9914449 -0.2588190 -0.9238795 0.5 0.7933533 [8,] 0.9238795 -0.7071068 -0.3826834 1.0 -0.3826834 [9,] 0.7933533 -0.9659258 0.3826834 0.5 -0.9914449 [10,] 0.6087614 -0.9659258 0.9238795 -0.5 -0.1305262 [11,] 0.3826834 -0.7071068 0.9238795 -1.0 0.9238795 [12,] 0.1305262 -0.2588190 0.3826834 -0.5 0.6087614 > print(mat2 %*% base.simul.far(24,5)) [,1] [,2] [,3] [,4] [,5] [1,] 0.3826834 0.7071068 0.92387953 1.0000000 0.9238795 [2,] 0.7933533 0.9659258 0.38268343 -0.5000000 -0.9914449 [3,] 0.9914449 0.2588190 -0.92387953 -0.5000000 0.7933533 [4,] 0.9812372 -0.3552914 -0.83717043 0.6464102 0.5795396 [5,] 0.8775962 -0.8342417 -0.07653669 0.8928203 -0.7693570 [6,] 0.6874377 -0.9931852 0.75046133 -0.1000000 -0.5917907 [7,] 0.4296101 -0.7706742 0.95432772 -0.9464102 0.7543277 [8,] 0.1305262 -0.2588190 0.38268343 -0.5000000 0.6087614 > > > > cleanEx(); ..nameEx <- "invgen" > > ### * invgen > > flush(stderr()); flush(stdout()) > > ### Name: invgen > ### Title: Generalized inverse of a Matrix > ### Aliases: invgen > ### Keywords: algebra > > ### ** Examples > > mat1<-matrix(rnorm(100),ncol=10) > print(invgen(mat1)) [,1] [,2] [,3] [,4] [,5] [,6] [1,] -13.825151 -4.3184113 -3.7000251 -5.506495 0.5009748 -6.5247939 [2,] 7.994360 1.8052921 2.2319906 3.018080 0.3584867 2.8063310 [3,] -6.649862 -2.4144670 -1.8767437 -2.818813 0.3564758 -3.5575836 [4,] 7.232936 2.1861880 2.1836477 2.997720 -0.1046897 2.8473677 [5,] 12.278540 0.9168271 3.8196078 4.913329 1.2334000 3.0025610 [6,] 2.717678 -0.4786131 0.8351732 1.140262 0.6603351 0.4588977 [7,] -9.823408 -2.0904683 -2.8146177 -3.933019 -0.3252120 -3.4410930 [8,] -5.963940 -2.4621870 -1.3866467 -2.630870 0.2651148 -3.2566274 [9,] -10.142430 -1.4869602 -2.5858930 -4.091287 -0.5530366 -3.1641313 [10,] 3.436236 0.9195799 1.2717637 1.419886 0.2450668 1.1145296 [,7] [,8] [,9] [,10] [1,] -14.306056 -1.99549944 6.334032 6.202524 [2,] 7.748990 1.21223209 -3.345774 -3.817137 [3,] -7.071454 -1.35593861 2.777684 3.214341 [4,] 7.135073 0.71829677 -2.582743 -3.345652 [5,] 11.487521 1.12662482 -5.516016 -5.498401 [6,] 2.233701 -0.02538002 -1.035674 -1.160704 [7,] -9.734169 -1.06138434 4.192695 4.746664 [8,] -6.580432 -0.81074485 2.606928 2.292045 [9,] -9.410905 -0.99029678 4.544780 4.673129 [10,] 3.164472 0.45290536 -1.406302 -1.794221 > > > > cleanEx(); ..nameEx <- "is.na.fdata" > > ### * is.na.fdata > > flush(stderr()); flush(stdout()) > > ### Name: is.na.fdata > ### Title: Not Available / ``Missing'' Values > ### Aliases: is.na.fdata > ### Keywords: NA > > ### ** Examples > > # Reading of the data > library(stats) > data(UKDriverDeaths) > UKDriverDeaths[20]<-NA > > # Making the data of class 'fdata' > fUKDriverDeaths <- as.fdata(UKDriverDeaths,col=1,p=12,dates=1969:1984, + name="UK Driver Deaths") > summary(fUKDriverDeaths) Variable: UK Driver Deaths Mean of the norms: L1 norm L2 norm Linf norm 1659.778 1674.481 2111.467 > is.na(fUKDriverDeaths) 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 UK Driver Deaths FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 1979 1980 1981 1982 1983 1984 UK Driver Deaths FALSE FALSE FALSE FALSE FALSE FALSE > > > > cleanEx(); ..nameEx <- "kerfon" > > ### * kerfon > > flush(stderr()); flush(stdout()) > > ### Name: kerfon > ### Title: Functional Kernel estimation > ### Aliases: kerfon print.kerfon > ### Keywords: ts nonlinear > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Cross validation > model1 <- kerfon(data=data1, x="X", r=10, na.rm=TRUE) > print(model1) Functional Kernel Model Call: kerfon(data = data1, x = "X", r = 10, na.rm = TRUE) Window: 0.5573 optimized between 0.1078 and 3.448 . > > > > cleanEx(); ..nameEx <- "maxfdata" > > ### * maxfdata > > flush(stderr()); flush(stdout()) > > ### Name: maxfdata > ### Title: Maxima of functional data > ### Aliases: maxfdata > ### Keywords: ts univar > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > print(data2 <- maxfdata(data1)) Functionnal data Variable(s): X Z Number of points per observation: 1 1 Number of observations: 400 > print(unclass(data2)) $X 1 2 3 4 5 6 7 max -0.1010156 0.7132163 2.495813 1.518378 0.4480167 0.6939509 0.3164074 8 9 10 11 12 13 14 15 max 0.7917991 1.876288 1.731438 2.300905 3.055441 1.940824 1.372684 1.305549 16 17 18 19 20 21 22 max 1.242554 0.9124835 0.8641876 0.9771688 -0.05194533 -0.2610389 1.025873 23 24 25 26 27 28 29 max 0.5333289 0.2686452 -0.2159234 0.1716049 0.1647117 0.009387854 -0.1016715 30 31 32 33 34 35 36 max 0.1874863 1.009156 1.332417 2.185262 2.010823 0.0645334 0.3804918 37 38 39 40 41 42 43 max -0.05016151 -0.07776367 1.650761 1.077777 -0.05401307 0.08757407 0.5839268 44 45 46 47 48 49 50 max 2.186263 2.168751 1.339678 1.496823 1.713679 0.6891603 -0.09572803 51 52 53 54 55 56 57 max -0.0491428 -0.2749723 0.638054 1.163135 0.4753103 0.1277513 0.705892 58 59 60 61 62 63 64 max 0.9533662 0.4928695 1.700466 1.020792 0.7696465 1.584532 0.1432109 65 66 67 68 69 70 71 max 0.00704675 0.6417929 1.530216 0.644246 1.097699 0.3704817 0.5178657 72 73 74 75 76 77 78 79 max 0.589687 0.8924884 1.016998 0.9203153 1.822978 1.762341 0.6728838 0.7423682 80 81 82 83 84 85 86 87 max 1.679899 1.308422 1.493429 1.022911 0.6192183 1.579343 1.244166 1.188989 88 89 90 91 92 93 94 95 max 1.564525 1.344060 1.127295 0.6796128 1.151392 0.8363051 1.487203 0.1173142 96 97 98 99 100 101 102 max -0.1031619 -0.1557994 -0.1772877 -0.138189 0.2633332 0.7988573 1.413127 103 104 105 106 107 108 109 max 1.158416 0.4338737 0.5179881 -0.3173108 0.51951 0.03489208 0.2083153 110 111 112 113 114 115 116 max 0.1003762 -0.08154127 -0.03031543 1.175979 1.503462 0.7958253 0.8174335 117 118 119 120 121 122 123 max -0.0381804 1.033042 0.1559282 0.7647336 0.1195884 -0.03297879 -0.1543814 124 125 126 127 128 129 130 max 0.07918365 0.4176033 -0.1008213 0.07839438 0.4205813 0.6563414 1.471635 131 132 133 134 135 136 137 max 1.905643 2.079965 1.047587 0.4252164 0.1390378 0.05042964 0.6024963 138 139 140 141 142 143 144 145 max 1.525503 1.16501 0.01923436 0.4324165 1.565156 1.921635 1.501549 1.328577 146 147 148 149 150 151 152 153 max 0.930924 1.547227 0.7809766 1.090430 1.882570 0.5846315 0.7903083 0.751663 154 155 156 157 158 159 160 max 0.848109 0.6007455 0.5907021 0.5054111 0.06964601 0.6128254 0.7648289 161 162 163 164 165 166 167 max 1.099799 0.7609282 2.120016 2.107818 0.8205771 -0.005375669 -0.0321322 168 169 170 171 172 173 174 max -0.1661596 0.009290689 0.9515758 1.001785 0.8690788 1.479892 1.643436 175 176 177 178 179 180 181 max 1.484759 0.643544 0.1700746 -0.04157489 -0.2002038 -0.1304453 0.5183949 182 183 184 185 186 187 188 max 0.1497949 0.3527947 1.713474 0.794941 0.956181 0.9084418 1.330257 189 190 191 192 193 194 195 max -0.05770006 -0.1898031 0.5169969 0.1484617 0.2588956 0.3147443 -0.1930627 196 197 198 199 200 201 max -0.3049479 -0.2168967 -0.06655482 -0.01638598 0.3946198 -0.1500443 202 203 204 205 206 207 208 max -0.1276518 -0.02960653 0.2257825 0.005321331 1.329931 -0.01360351 0.9349315 209 210 211 212 213 214 215 max 0.1351691 0.5031351 0.8855921 0.02491391 -0.302968 -0.09582018 0.438341 216 217 218 219 220 221 222 max 0.2019415 1.204108 0.1462981 0.2740816 0.3241976 1.430775 0.8745775 223 224 225 226 227 228 max -0.02650447 -0.006850135 -0.00899392 -0.2480605 -0.2165047 0.3568681 229 230 231 232 233 234 235 236 max 0.5221277 0.4138939 1.923240 1.312216 1.988464 1.973314 1.123317 0.4992281 237 238 239 240 241 242 max -0.1093271 -0.1013566 0.3952612 -0.1045330 -0.07575849 -0.1390156 243 244 245 246 247 248 249 max -0.0543873 -0.1475514 0.7941453 0.1069388 0.07283727 0.3940845 1.248195 250 251 252 253 254 255 256 max 1.457795 0.716431 0.7387174 0.6818134 0.6163666 0.2590744 0.2514523 257 258 259 260 261 262 263 max 0.4693278 0.3489862 0.1090217 1.227881 0.07871636 0.446314 0.8718739 264 265 266 267 268 269 270 271 max 1.024490 2.301813 1.66585 1.914592 0.2366464 1.167475 1.197224 1.366758 272 273 274 275 276 277 278 max 0.2491768 0.4277623 -0.05980346 0.3561484 2.001370 0.2130439 -0.1882467 279 280 281 282 283 284 285 max -0.1331968 0.3242698 1.096615 0.1798725 2.123111 2.693240 2.161570 286 287 288 289 290 291 292 293 max 0.9756432 1.252386 2.247814 2.056213 1.63533 1.722112 1.397722 1.089033 294 295 296 297 298 299 300 301 max 1.662352 0.976824 0.4642972 0.8122012 0.655087 1.598227 2.468999 2.236053 302 303 304 305 306 307 308 max 1.879456 1.050974 0.5543862 0.850659 0.09355786 0.02096657 0.428271 309 310 311 312 313 314 315 max 0.712264 0.3862869 0.8944884 0.1530240 1.398245 0.918393 -0.08500455 316 317 318 319 320 321 322 max 0.5601632 0.06801813 0.06109288 0.8731596 0.9663362 1.156205 0.604987 323 324 325 326 327 328 329 max 1.248420 0.4725149 0.9653917 0.4698609 -0.1065924 0.1127458 0.4054392 330 331 332 333 334 335 336 max 1.072058 1.327628 0.5739085 0.2402064 0.8603494 0.5055411 -0.09619313 337 338 339 340 341 342 343 max 0.1351738 0.01955777 0.02710675 0.1122883 0.2355824 1.383878 2.153488 344 345 346 347 348 349 350 max 1.212600 1.508309 1.085210 -0.09642489 0.2975554 -0.1593404 0.4151236 351 352 353 354 355 356 357 max 0.2980677 -0.05971301 0.5654694 0.1210663 -0.01616134 0.8482617 0.6016855 358 359 360 361 362 363 364 max 0.9483802 1.362715 0.3927698 -0.1813224 0.1391460 -0.07382595 0.01952450 365 366 367 368 369 370 max 0.2502335 0.6327557 -0.05501876 -0.09590249 -0.1263405 -0.2524767 371 372 373 374 375 376 max -0.2410609 -0.2169704 -0.1219868 0.02237512 -0.1052662 -0.2261128 377 378 379 380 381 382 max -0.3850817 -0.2187482 -0.3086697 -0.1624611 -0.3371804 -0.4501254 383 384 385 386 387 388 389 max -0.2744921 0.1270656 0.2914468 -0.1296370 -0.3150632 -0.2492717 0.5642455 390 391 392 393 394 395 396 max 0.1474872 0.7527028 0.4198355 0.5717891 0.01031296 -0.1995186 0.2830384 397 398 399 400 max 0.6371829 0.1036638 0.8964317 1.671488 $Z 1 2 3 4 5 6 7 max 0.9651486 2.956597 0.6789333 -0.2700487 -0.3263427 -0.4351612 -0.03762919 8 9 10 11 12 13 14 max 0.831662 1.150996 1.318848 2.100652 0.4694949 0.2924597 -0.04875602 15 16 17 18 19 20 max -0.2509131 -0.1554130 -0.01488060 -0.1243946 -0.4294407 -0.3196425 21 22 23 24 25 26 27 max -0.1727919 0.3451557 -0.2317997 -0.1112362 0.1709108 -0.0421276 -0.4051188 28 29 30 31 32 33 34 max -0.1420660 0.3163174 2.437581 0.553727 -0.03148404 0.2689413 -0.3195435 35 36 37 38 39 40 41 max -0.2571582 0.2976109 -0.02451253 0.8231066 0.9875652 -0.1536272 -0.05232215 42 43 44 45 46 47 48 max 0.2018962 1.793509 2.363901 -0.03822979 0.1097394 -0.03165268 -0.1092240 49 50 51 52 53 54 55 max -0.1515755 -0.2375210 -0.3954461 0.2459418 -0.2055441 -0.2036637 -0.1544701 56 57 58 59 60 61 62 max 0.9997293 1.301949 0.258528 1.150327 0.4137598 0.3120176 1.412669 63 64 65 66 67 68 69 max -0.1996426 -0.08593584 1.299844 1.113243 0.3955453 -0.03923323 -0.04493533 70 71 72 73 74 75 76 max 0.1015802 0.4538289 -0.008018347 0.7975006 -0.1053604 1.657979 0.8035941 77 78 79 80 81 82 83 max 0.838487 0.7088855 2.606219 1.081346 1.260443 0.4059053 -0.04519262 84 85 86 87 88 89 90 max 0.889995 0.7880571 -0.05863023 0.6276818 0.8292124 1.123916 1.578669 91 92 93 94 95 96 97 max 0.4317033 0.3271434 1.058998 -0.1424061 -0.1546011 -0.4459443 -0.2682216 98 99 100 101 102 103 max -0.07713522 -0.01384903 0.5638451 -0.02465689 -0.01558295 0.3845533 104 105 106 107 108 109 max 1.664645 -0.02784714 0.9862696 0.004564793 -0.0675002 -0.03470873 110 111 112 113 114 115 116 max -0.2498971 -0.1477840 1.161454 2.158883 0.8761425 0.3427803 -0.02996519 117 118 119 120 121 122 123 max 0.8881628 0.3526303 0.5863637 -0.1286679 -0.112183 -0.03603336 -0.3688408 124 125 126 127 128 129 max -0.04303925 -0.1972407 -0.03173316 -0.3079337 0.05255364 0.5508121 130 131 132 133 134 135 136 max -0.05348501 0.1659905 -0.1870467 -0.3243098 -0.02257991 -0.133402 0.3599061 137 138 139 140 141 142 143 max 1.294862 -0.09698683 -0.1617793 -0.1476402 0.8218919 0.9609316 0.08344169 144 145 146 147 148 149 150 max 0.240602 -0.06194165 2.013569 0.887841 0.3854657 1.150649 1.527654 151 152 153 154 155 156 157 max 0.7433078 0.4421784 1.426362 0.8482691 0.7805157 0.92132 -0.07225733 158 159 160 161 162 163 164 max -0.02227127 0.6893526 -0.04290275 1.010127 1.891124 1.782769 -0.1408752 165 166 167 168 169 170 171 max -0.1741706 -0.1715419 -0.1842597 0.3868108 2.539941 1.452570 1.042917 172 173 174 175 176 177 178 max 0.7851603 1.211490 1.353818 -0.1882144 -0.05185322 -0.1182957 -0.08790101 179 180 181 182 183 184 185 max -0.02900089 1.436308 -0.1704497 -0.05954381 1.127962 -0.0273365 1.574594 186 187 188 189 190 191 192 max 0.6721655 1.979904 0.05622093 -0.02228574 0.8545134 -0.05144792 -0.03779344 193 194 195 196 197 198 199 max -0.1678435 -0.3554584 -0.435883 -0.00782821 1.367826 -0.1066826 -0.0605267 200 201 202 203 204 205 max -0.1597264 -0.0985205 -0.07694708 -0.1130042 -0.1265800 -0.2034838 206 207 208 209 210 211 212 max -0.2305284 0.7013 -0.04865389 -0.1448781 0.1072694 -0.3223817 -0.6104071 213 214 215 216 217 218 max -0.1099878 -0.06754673 -0.0999109 -0.02345315 -0.09875465 -0.02776409 219 220 221 222 223 224 max -0.07085047 0.0259904 -0.02769513 -0.1084468 -0.2355328 -0.2071263 225 226 227 228 229 230 231 max -0.2237027 -0.2232976 0.2718158 1.334238 0.4650043 0.9216143 0.6788036 232 233 234 235 236 237 238 max 2.042747 0.3059749 0.9441714 0.2637815 0.08605273 -0.1699396 0.8804234 239 240 241 242 243 244 245 max -0.2955359 -0.1417550 0.407666 -0.3535450 -0.0377817 -0.02890392 -0.1471954 246 247 248 249 250 251 max -0.05175947 -0.03287259 0.5560244 0.5304439 -0.1246231 -0.1389848 252 253 254 255 256 257 max -0.1805178 -0.1651544 -0.0480312 -0.1301794 0.4343209 -0.02301782 258 259 260 261 262 263 264 max -0.06824469 0.7928395 -0.2048405 -0.1778687 -0.02140537 0.6797201 1.914422 265 266 267 268 269 270 271 max 0.8939873 1.616004 -0.05467751 1.825520 0.7849212 1.342504 0.1935835 272 273 274 275 276 277 278 max -0.07240525 -0.1512918 0.01140693 2.002329 -0.1735611 -0.1239403 -0.1692529 279 280 281 282 283 284 285 286 max 1.098033 0.81414 -0.1486887 1.404011 1.840771 1.957715 0.5952522 1.453111 287 288 289 290 291 292 293 294 max 2.191853 0.5695829 1.790373 0.9969513 2.178338 1.405665 1.056962 0.1251684 295 296 297 298 299 300 301 max -0.005612642 -0.1240243 -0.1270559 1.676588 0.7523633 0.7643023 0.4663664 302 303 304 305 306 307 308 max -0.0390193 0.006240157 -0.1467013 -0.4339883 -0.1203355 1.174233 1.986093 309 310 311 312 313 314 315 max -0.04762385 0.1619023 0.4743629 1.921953 -0.002403594 0.3086191 0.4057551 316 317 318 319 320 321 max -0.2981753 -0.3069650 -0.3093003 -0.2048321 -0.2773449 -0.1026155 322 323 324 325 326 327 max -0.04589989 -0.1533848 0.2789006 -0.01169533 -0.1631737 -0.0777672 328 329 330 331 332 333 max -0.04363070 0.6875285 0.0798387 -0.06148797 -0.1067956 -0.05419666 334 335 336 337 338 339 max -0.1626592 -0.1524004 -0.2673181 -0.2953074 -0.01591780 0.2321514 340 341 342 343 344 345 346 max -0.03992365 0.2182331 1.379437 -0.0103204 0.5754573 1.140484 -0.02492219 347 348 349 350 351 352 max -0.000192573 -0.2248185 0.9980576 -0.01554648 -0.2106815 -0.01414113 353 354 355 356 357 358 359 max 0.3491711 -0.1111351 1.653674 2.660962 1.648025 0.5729122 0.1128736 360 361 362 363 364 365 max -0.2761931 -0.1323169 -0.1728691 -0.1722072 -0.005990528 -0.1535691 366 367 368 369 370 371 372 max 0.1010316 -0.1489605 0.3253418 -0.2873672 -0.1356407 -0.269354 -0.3011868 373 374 375 376 377 378 max -0.0930659 -0.2911415 -0.3200532 -0.5727284 -0.1116824 -0.2349259 379 380 381 382 383 384 max -0.4006466 -0.3123873 -0.2393834 -0.2261507 -0.1807792 0.5385924 385 386 387 388 389 390 391 max -0.04046492 -0.1543621 -0.4386597 -0.2819407 -0.06438468 1.296179 1.190985 392 393 394 395 396 397 398 max 0.6956344 -0.36853 -0.2937639 0.46548 -0.1335454 -0.0837746 -0.3103166 399 400 max -0.05307926 1.016893 > > > > cleanEx(); ..nameEx <- "multplot" > > ### * multplot > > flush(stderr()); flush(stdout()) > > ### Name: multplot > ### Title: Multivariate plots > ### Aliases: multplot multplot.default multplot.fdata > ### Keywords: hplot > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=100,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # 2 variables : X et Z > # number of points per curve : 10 > # number of curves : 100 > # corresponding dates > date.fdata(data1) [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" [13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" [25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" [37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" [49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" [61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" [73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" [85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" [97] "97" "98" "99" "100" > > multplot(data1) # plot the date "1" of the variables "X" and "Z" > multplot(data1,legend=TRUE) # Same thing with a legend > multplot(data1,legend=TRUE,yleg=-0.5) # same thing with a legend misplaced > multplot(data1,main="day 1",legend=TRUE,xlab="hour", + ylab="object of study") > > par(mfrow=c(1,3)) > multplot(data1,date=c("3","4","5")) # days "3", "4" and "5" are plotted > par(mfrow=c(1,1)) > > # to plot the whole series, we used whole = TRUE > # but we have to give the x values > > multplot(data1,xval=seq(from=0,to=99.9,by=0.1),whole=TRUE) > > # to plot a subset of the series, > # it is recommended to create a subset object with select.fdata > data2 <- select.fdata(data1,date=c("4","5","6")) > multplot(data2,xval=seq(from=4,to=6.9,by=0.1),whole=TRUE) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "orthonormalization" > > ### * orthonormalization > > flush(stderr()); flush(stdout()) > > ### Name: orthonormalization > ### Title: Orthonormalization of a set of a matrix > ### Aliases: orthonormalization > ### Keywords: algebra > > ### ** Examples > > mat1 <- matrix(c(1,0,1,1,1,0),nrow=3,ncol=2) > orth1 <- orthonormalization(mat1, basis=FALSE, norm=FALSE) > orth2 <- orthonormalization(mat1, basis=FALSE, norm=TRUE) > orth3 <- orthonormalization(mat1, basis=TRUE, norm=TRUE) > crossprod(orth1) [,1] [,2] [1,] 2 0.0 [2,] 0 1.5 > crossprod(orth2) [,1] [,2] [1,] 1.000000e+00 2.451427e-17 [2,] 2.451427e-17 1.000000e+00 > crossprod(orth3) [,1] [,2] [,3] [1,] 1.000000e+00 2.451427e-17 -5.197279e-18 [2,] 2.451427e-17 1.000000e+00 -1.045504e-16 [3,] -5.197279e-18 -1.045504e-16 1.000000e+00 > > > > cleanEx(); ..nameEx <- "plot.fdata" > > ### * plot.fdata > > flush(stderr()); flush(stdout()) > > ### Name: plot.fdata > ### Title: Plot Functional Data > ### Aliases: plot.fdata > ### Keywords: ts aplot > > ### ** Examples > > # Reading of the data > library(stats) > data(UKDriverDeaths) > > # Making the data of class 'fdata' > fUKDriverDeaths <- as.fdata(UKDriverDeaths, col=1, p=12, + dates=1969:1984, + name="UK Driver Deaths") > summary(fUKDriverDeaths) Variable: UK Driver Deaths Mean of the norms: L1 norm L2 norm Linf norm 1670.307 1685.357 2134.375 > > # plotting of the data : whole and 1 year > par(mfrow=c(2,1)) > plot(fUKDriverDeaths, xval=1969+(1:192)/12, + whole=TRUE, name="Whole Evolution : ", separator=TRUE) > plot(fUKDriverDeaths, date="1984", xval=1:12, + name="Evolution during year 1984 : ") > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "pred.persist" > > ### * pred.persist > > flush(stderr()); flush(stdout()) > > ### Name: pred.persist > ### Title: Forecasting using functional persistence > ### Aliases: pred.persist > ### Keywords: ts misc > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=40,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > print(data2 <- pred.persist(data1,x="X",label="41")) Functionnal data Variable(s): X Number of points per observation: 10 Number of observations: 40 > print(unclass(select.fdata(data1,date=paste(38:40)))$X) 38 39 40 1 -0.11110268 0.05954643 0.1122622 2 -0.29372031 0.28796959 0.3551204 3 -0.38302580 0.73650096 0.6280883 4 -0.38216909 1.28380499 0.8893333 5 -0.33976726 1.65076109 1.0606342 6 -0.30642824 1.61511768 1.0777773 7 -0.29488643 1.19048933 0.9342147 8 -0.27513849 0.62115647 0.6835648 9 -0.20643765 0.19465393 0.4000018 10 -0.07776367 0.02390302 0.1294053 > print(unclass(select.fdata(data2,date=paste(39:41)))) $X 39 40 41 1 -0.11110268 0.05954643 0.1122622 2 -0.29372031 0.28796959 0.3551204 3 -0.38302580 0.73650096 0.6280883 4 -0.38216909 1.28380499 0.8893333 5 -0.33976726 1.65076109 1.0606342 6 -0.30642824 1.61511768 1.0777773 7 -0.29488643 1.19048933 0.9342147 8 -0.27513849 0.62115647 0.6835648 9 -0.20643765 0.19465393 0.4000018 10 -0.07776367 0.02390302 0.1294053 > > > > cleanEx(); ..nameEx <- "predict.far" > > ### * predict.far > > flush(stderr()); flush(stdout()) > > ### Name: predict.far > ### Title: Forecasting of FARX(1) model > ### Aliases: predict.far > ### Keywords: ts methods > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Cross validation (joined and separate) > model1.cv <- far.cv(data=data1, y="X", x="Z", kn=8, ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=TRUE) > model2.cv <- far.cv(data=data1, y="X", x="Z", kn=c(4,4), ncv=10, cvcrit="X", + center=FALSE, na.rm=FALSE, joined=FALSE) > print(model1.cv) $cv k1 L1 L2 Linf L1max L2max Linfmax [1,] 1 0.5440224 0.6181106 0.9675649 0.4057501 0.4915427 0.9286690 [2,] 2 0.5262087 0.6053697 0.9348789 0.4444624 0.5440946 0.9952749 [3,] 3 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 [4,] 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [5,] 5 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [6,] 6 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [7,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [8,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2 k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minLinf k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL1max k1 L1 L2 Linf L1max L2max Linfmax 3.0000000 0.4465614 0.5172139 0.8169021 0.3621510 0.4381015 0.7803080 $minL2max k1 L1 L2 Linf L1max L2max Linfmax [1,] 7 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 8 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 L1 L2 Linf L1max L2max Linfmax 8.0000000 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > print(model2.cv) $cv k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 1 1 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [2,] 1 2 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [3,] 1 3 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [4,] 1 4 0.5263334 0.6056154 0.9351213 0.4467516 0.5460505 0.9945951 [5,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [6,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [7,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [8,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.4380810 0.7803234 [9,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [10,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [11,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [12,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [13,] 4 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [14,] 4 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [15,] 4 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [16,] 4 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minL1 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2 k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minLinf k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL1max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 2 1 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [2,] 2 2 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [3,] 2 3 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 [4,] 2 4 0.4464636 0.5170762 0.8163687 0.3620424 0.438081 0.7803234 $minL2max k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 $minLinfmax k1 k2 L1 L2 Linf L1max L2max Linfmax [1,] 3 1 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [2,] 3 2 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [3,] 3 3 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 [4,] 3 4 0.4477903 0.5186713 0.8205077 0.3643876 0.4229052 0.7492347 > k1 <- model1.cv$minL2[1] > k2 <- model2.cv$minL2[1:2] > > # Modelization of the FARX process (joined and separate) > model1 <- far(data=data1, y="X", x="Z", kn=k1, + center=FALSE, na.rm=FALSE, joined=TRUE) > model2 <- far(data=data1, y="X", x="Z", kn=k2, + center=FALSE, na.rm=FALSE, joined=FALSE) > > # Predicting values > pred1 <- predict(model1,newdata=data1) > pred2 <- predict(model2,newdata=data1) > # Persistence > persist1 <- pred.persist(select.fdata(data1,date=1:399),x="X") > # Real values > real1 <- select.fdata(data1,date=2:400) > > errors0 <- persist1[[1]]-real1[[1]] > errors1 <- pred1[[1]]-real1[[1]] > errors2 <- pred2[[1]]-real1[[1]] > > # Norm of observations > summary(real1) Variable: X Mean of the norms: L1 norm L2 norm Linf norm 0.6588022 0.7749319 1.2497863 Variable: Z Mean of the norms: L1 norm L2 norm Linf norm 0.6047724 0.6689742 0.9344247 > # Persistence > summary(as.fdata(errors0)) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.4964692 0.5782693 0.9183925 > # FARX models > summary(as.fdata(errors1)) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.4319548 0.5044062 0.8031829 > summary(as.fdata(errors2)) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.4319601 0.5044098 0.8031802 > > > > cleanEx(); ..nameEx <- "predict.kerfon" > > ### * predict.kerfon > > flush(stderr()); flush(stdout()) > > ### Name: predict.kerfon > ### Title: Forecasting of functional kernel model > ### Aliases: predict.kerfon > ### Keywords: models ts > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Cross validation > model1 <- kerfon(data=data1, x="X", r=10, na.rm=TRUE) > print(model1) Functional Kernel Model Call: kerfon(data = data1, x = "X", r = 10, na.rm = TRUE) Window: 0.5573 optimized between 0.1078 and 3.448 . > > # Predicting values > pred1 <- predict(model1,newdata=select.fdata(data1,date=1:399)) > # Persistence > persist1 <- pred.persist(select.fdata(data1,date=1:399),x="X") > # Real values > real1 <- select.fdata(data1,date=2:400) > > errors0 <- persist1[[1]]-real1[[1]] > errors1 <- pred1[[1]]-real1[[1]] > > # Norm of observations > summary(real1) Variable: X Mean of the norms: L1 norm L2 norm Linf norm 0.6588022 0.7749319 1.2497863 Variable: Z Mean of the norms: L1 norm L2 norm Linf norm 0.6047724 0.6689742 0.9344247 > # Persistence > summary(as.fdata(errors0)) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.4964692 0.5782693 0.9183925 > # kerfon model > summary(as.fdata(errors1)) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.4068915 0.4746411 0.7519100 > > > > cleanEx(); ..nameEx <- "select.fdata" > > ### * select.fdata > > flush(stderr()); flush(stdout()) > > ### Name: select.fdata > ### Title: Subscript of fdata > ### Aliases: select.fdata > ### Keywords: manip > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > print(data1) Functionnal data Variable(s): X Z Number of points per observation: 10 10 Number of observations: 400 > print(data1.X <- select.fdata(data1,name="X")) Functionnal data Variable(s): X Number of points per observation: 10 Number of observations: 400 > print(data2 <- select.fdata(data1,date=paste((1:5)*5))) Functionnal data Variable(s): X Z Number of points per observation: 10 10 Number of observations: 5 > date.fdata(data2) [1] "5" "10" "15" "20" "25" > > > > cleanEx(); ..nameEx <- "simul.far" > > ### * simul.far > > flush(stderr()); flush(stdout()) > > ### Name: simul.far > ### Title: FAR(1) process simulation > ### Aliases: simul.far > ### Keywords: ts misc > > ### ** Examples > > far1 <- simul.far(m=64,n=100) > summary(far1) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.6419768 0.7620008 1.2309113 > print(far(far1,kn=4)) Functional Autoregressive Model Call: far(data = far1, kn = 4) Variable: var Dimension of the subspace: 4 Explained Variance: 100 % Estimated first Eigen values of the Covariance: 5.944e-01 1.173e-01 1.503e-02 6.967e-06 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [,4] [1,] 0.493 0.111 0.302 0.198 [2,] 0.073 0.795 -0.069 -11.884 [3,] -0.003 0.026 0.279 2.710 [4,] 0.000 -0.001 0.000 0.389 > par(mfrow=c(2,1)) > plot(far1,date=1) > plot(select.fdata(far1,date=1:5),whole=TRUE,separator=TRUE) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "simul.far.sde" > > ### * simul.far.sde > > flush(stderr()); flush(stdout()) > > ### Name: simul.far.sde > ### Title: FAR-SDE process simulation > ### Aliases: simul.far.sde > ### Keywords: ts misc > > ### ** Examples > > far1 <- simul.far.sde() > summary(far1) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.9063414 0.9295883 1.1433742 > print(far(far1,kn=2)) Functional Autoregressive Model Call: far(data = far1, kn = 2) Variable: var Dimension of the subspace: 2 Explained Variance: 100 % Estimated first Eigen values of the Covariance: 1.092 0.042 Estimated correlation Matrix in adequate subspace: [,1] [,2] [1,] 0.805 -2.652 [2,] 0.100 0.409 > par(mfrow=c(2,1)) > plot(far1,date=1) > plot(select.fdata(far1,date=1:5),whole=TRUE,separator=TRUE) > > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "simul.far.wiener" > > ### * simul.far.wiener > > flush(stderr()); flush(stdout()) > > ### Name: simul.far.wiener > ### Title: FAR(1) process simulation with Wiener noise > ### Aliases: simul.far.wiener > ### Keywords: ts misc > > ### ** Examples > > far1 <- simul.far.wiener(m=64,n=100) > summary(far1) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.6892416 0.8018412 1.4549522 > print(far(far1,kn=4)) Functional Autoregressive Model Call: far(data = far1, kn = 4) Variable: var Dimension of the subspace: 4 Explained Variance: 100 % Estimated first Eigen values of the Covariance: 0.69974 0.07824 0.02385 0.01187 Estimated correlation Matrix in adequate subspace: [,1] [,2] [,3] [,4] [1,] 0.564 -0.082 0.021 -0.252 [2,] 0.023 0.747 -0.119 0.031 [3,] -0.003 -0.056 0.401 -0.452 [4,] -0.001 -0.006 0.043 0.378 > par(mfrow=c(2,1)) > plot(far1,date=1) > plot(select.fdata(far1,date=1:5),whole=TRUE,separator=TRUE) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "simul.farx" > > ### * simul.farx > > flush(stderr()); flush(stdout()) > > ### Name: simul.farx > ### Title: FARX(1) process simulation > ### Aliases: simul.farx theoretical.coef > ### Keywords: ts > > ### ** Examples > > # Simulation of a FARX process > data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Modelisation of the FARX process (joined and separate) > model1 <- far(data1,k=4,joined=TRUE) > model2 <- far(data1,k=c(3,1),joined=FALSE) > > # Calculation of the theoretical coefficients > coef.theo <- theoretical.coef(m=10,base=base.simul.far(20,5), + base.exo=base.simul.far(20,5), + d.a=matrix(c(0.5,0),nrow=1,ncol=2), + alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2), + d.rho=diag(c(0.45,0.90,0.34,0.45)), + alpha=diag(c(0.5,0.23,0.018)), + d.rho.exo=diag(c(0.45,0.90,0.34,0.45)), + cst1=0.0) > > # Joined coefficient > round(coef(model1),2) [,1] [,2] [,3] [,4] [1,] 0.71 0.12 0.09 -0.08 [2,] -0.32 0.16 -0.10 -0.07 [3,] -0.02 -0.09 0.87 0.02 [4,] 0.00 0.00 0.00 0.25 > coef.theo$rho.T [,1] [,2] [,3] [,4] [1,] 0.672 -0.134 0.0 0.00 [2,] 0.366 0.228 0.0 0.00 [3,] 0.000 0.000 0.9 0.00 [4,] 0.000 0.000 0.0 0.34 > > # Separate coefficient > round(coef(model2),2) [,1] [,2] [,3] [,4] [1,] 0.41 0.09 0.01 -0.52 [2,] 0.04 0.88 0.02 0.03 [3,] 0.00 0.00 0.25 0.00 [4,] -0.08 -0.05 0.10 0.45 > coef.theo$rho.X.Z [,1] [,2] [,3] [,4] [1,] 0.45 0.0 0.00 0.50 [2,] 0.00 0.9 0.00 0.00 [3,] 0.00 0.0 0.34 0.00 [4,] 0.00 0.0 0.00 0.45 > > > > cleanEx(); ..nameEx <- "simul.wiener" > > ### * simul.wiener > > flush(stderr()); flush(stdout()) > > ### Name: simul.wiener > ### Title: Wiener process simulation > ### Aliases: simul.wiener > ### Keywords: ts misc > > ### ** Examples > > noise <- simul.wiener(m=64,n=100,m2=512) > summary(noise) Variable: var Mean of the norms: L1 norm L2 norm Linf norm 0.5762007 0.6706646 1.2546554 > par(mfrow=c(2,1)) > plot(noise,date=1) > plot(select.fdata(noise,date=1:5),whole=TRUE,separator=TRUE) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > ### *