plot.funData: A method to plot 'funData' objects

Description Usage Arguments See Also Examples

Description

This function performs the plot of a functional univariate dataset stored in an object of class funData.

Usage

1
2
## S3 method for class 'funData'
plot(x, ...)

Arguments

x

the univariate functional dataset in form of funData object.

...

additional graphical parameters to be used in plotting functions

See Also

funData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
N = 20

# Define parameters
n <- 50
P <- 100
K <- 150

# Grid of the functional dataset
t <- seq( 0, 1, length.out = P )

# Define the means and the parameters to use in the simulation
# with the Karhunen - Loève expansion
m1 <- t^2 * ( 1 - t )
m2 <- t * ( 1 - t )^2

lambda <- rep( 0, K )
theta <- matrix( 0, K, P )
for ( k in 1:K) {
  lambda[k] <- 1 / ( k + 1 )^2
  if ( k%%2 == 0 )
    theta[k, ] <- sqrt( 2 ) * sin( k * pi * t )
  else if ( k%%2 != 0 && k != 1 )
    theta[k, ] <- sqrt( 2 ) * cos( ( k - 1 ) * pi * t )
  else
    theta[k, ] <- rep( 1, P )
}
# Simulate the functional data
x1 <- simulate_KL( t, n, m1, rho = lambda, theta = theta )
x2 <- simulate_KL( t, n, m2, rho = lambda, theta = theta )

FD <- funData( t, list( as.matrix( x1$data[[1]] ), as.matrix( x2$data[[1]] ) ) )

plot(FD)

martinoandrea92/dpdistance documentation built on May 29, 2019, 3:44 a.m.