genTS2: Generate FDSLRM time series realization

Description Usage Arguments Details Value Note Examples

View source: R/genTS2.R

Description

genTS2(model_formula, beta, nu) generates a realization of a time series (FDSLRM) with mean value mean, variance parameters of white noise and random effects var and design matrix for random effects V. Normal distribution of white noise and random effects is assumed.

Usage

1
genTS2(model_formula, beta, nu, n)

Arguments

model_formula

object of class formula which contains a symbolic model formula including functions f_i(t) and v_j(t) neccessary to create design matrices F, V for fixed and random effects in FDSLRM.

beta

vector of mean value parameters.

nu

vector of variance parameters, the first one is for the white noise and the next are for the random effects.

n

length of realization.

Details

explain the form of FDSLRM time series realization as linear mixed model?

Value

Realization of particular FDSLRM time series.

Note

Ver.: 06-Jan-2019 19:15:30.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## EXAMPLE 1
# realization from general FDSLRM
model_formula <- formula(x ~ cos(2 * pi / 24 * t) + sin(2 * pi / 24 * t) +
                                 cos(2 * pi / 8 * t) + sin(2 * pi / 8 * t) +
                                 cos(2 * pi / 6 * t) + sin(2 * pi / 6 * t))
beta <- c (-3, 8, 7)
nu <- c(3, 2.7, 1.5, 1, 2)
times <- 1:24
n <- length(times)
realization <- genTS2(model_formula, beta, nu, n)
print(realization)
plot(times, realization, xlab = "time", type = "o")

## EXAMPLE 2
# realization from classical linear regression time series model (special case of FDSLRM)
model_formula <- formula(x ~ cos(2 * pi / 24 * t) + sin(2 * pi / 24 * t))
beta <- c (-3, 8, 7)
nu <- 3
times <- 1:24
n <- length(times)
realization <- genTS2(model_formula, beta, nu, n)
print(realization)
plot(times, realization, xlab = "time", type = "o")

gajdosandrej/fdslrm documentation built on April 28, 2020, 11:35 a.m.