Type: Package
Title: Computationally Efficient Maximum Likelihood Identification of Linear Dynamical Systems
Version: 0.3.0
Description: Provides implementations of computationally efficient maximum likelihood parameter estimation algorithms for models representing linear dynamical systems. Currently, two such algorithms (one offline and one online) are implemented for the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence. The corresponding scientific papers are referenced in the descriptions of the functions implementing these algorithms.
License: GPL-2
Copyright: Vilnius University Institute of Data Science and Digital Technologies
Imports: stats
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-09-17 19:34:47 UTC; milis
Author: Vytautas Dulskis [cre, aut], Leonidas Sakalauskas [aut]
Maintainer: Vytautas Dulskis <vytautas.dulskis@gmail.com>
Repository: CRAN
Date/Publication: 2025-09-17 19:50:02 UTC

calculate_likelihood

Description

Calculates the likelihood function value for given data and statistical measure values of the output-differenced version of the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence. Suitable when there are no contradictions in statistical measure values.

Usage

calculate_likelihood(dat, params)

Arguments

dat

An (n + 1) x (m + 1) data frame of finite numeric elements (possibly except for row 1, columns 1 to m) containing observed input (columns 1 to m) and output (column m + 1) data of the original model.

params

A list consisting of three elements: 1) Sigma ((m + 1) x (m + 1) matrix of finite numeric elements); 2) sigma_y^2 (vector of length 1, finite numeric element); 3) mu ((m + 1) x 1 matrix of finite numeric elements).

Value

Calculated likelihood function value (vector of length 1, numeric element).

Examples

set.seed(1)

m <- 4
k <- 2

L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1)
sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2)
mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1)

data <- generate_data(100, L, sigma, mu)
estimated_parameters <- estimate_parameters(data, 0.00001)

calculate_likelihood(data, estimated_parameters)


estimate_parameters

Description

Calculates maximum likelihood estimates of the statistical measures of the output-differenced version of the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence.

Usage

estimate_parameters(dat, tol)

Arguments

dat

An (n + 1) x (m + 1) data frame of finite numeric elements (possibly except for row 1, columns 1 to m) containing observed input (columns 1 to m) and output (column m + 1) data of the original model.

tol

A tolerance parameter of the golden section search algorithm used for minimizing the one-dimensional likelihood function (vector of length 1, finite positive numeric element).

Value

A list consisting of three elements: 1) estimate of the covariance at lag 0 of the data that result from the output-differenced model (Sigma; (m + 1) x (m + 1) matrix of numeric elements); 2) estimate of the only non-zero element of the negative covariance at lag 1 of the data that result from the output-differenced model (sigma_y^2; vector of length 1, numeric element); 3) estimate of the mean of the data that result from the output-differenced model (mu; (m + 1) x 1 matrix of numeric elements).

References

Leonidas Sakalauskas, Vytautas Dulskis, & Darius Plikynas (2024). A Technique for Efficient Estimation of Dynamic Structural Equation Models: A Case Study. Structural Equation Modeling: A Multidisciplinary Journal, 31(4), 635-650. DOI: 10.1080/10705511.2023.2282378

Examples

set.seed(1)

m <- 4
k <- 2

L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1)
sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2)
mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1)

data <- generate_data(100, L, sigma, mu)

estimate_parameters(data, 0.00001)


estimate_parameters_on

Description

Online maximum likelihood estimation of the statistical measures of the output-differenced version of the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence.

Usage

estimate_parameters_on(dat, s)

Arguments

dat

An (n + 1) x (m + 1) data frame of finite numeric elements (possibly except for row 1, columns 1 to m) containing observed input (columns 1 to m) and output (column m + 1) data of the original model.

s

Initial value of parameter s (a vector of length 1 containing a finite numeric element that belongs to the interval [0, 1]).

Value

A list containing n sublists, each representing a progressively larger data sample (with 1 to n observation points), where each sublist consists of three elements: 1) estimate of the covariance at lag 0 of the data that result from the output-differenced model (an (m + 1) x (m + 1) matrix of numeric elements); 2) estimate of the only non-zero element of the negative covariance at lag 1 of the data that result from the output-differenced model (a vector of length 1 containing a numeric element); 3) estimate of the mean of the data that result from the output-differenced model (an (m + 1) x 1 matrix of numeric elements).

References

Vytautas Dulskis & Leonidas Sakalauskas (2025). Toward Efficient Online Estimation of Dynamic Structural Equation Models: A Case Study. Journal of Statistical Computation and Simulation, 1-24. DOI: 10.1080/00949655.2025.2515955

Examples

set.seed(1)

m <- 4
k <- 2

L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1)
sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2)
mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1)

data <- generate_data(100, L, sigma, mu)

estimate_parameters_on(data, 0.35)


evaluate_estimates

Description

Calculates a discrepancy-function-based metric of accuracy of the statistical measure estimates for the output-differenced version of the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence. Suitable when there are no contradictions in the factuals/estimates.

Usage

evaluate_estimates(f, e, n)

Arguments

f

A list consisting of three elements: 1) the factual Sigma ((m + 1) x (m + 1) matrix of finite numeric elements); 2) the factual sigma_y^2 (vector of length 1, finite numeric element); 3) the factual mu ((m + 1) x 1 matrix of finite numeric elements).

e

Analogous to parameter f but with estimates instead of factuals.

n

The number of time moments used for obtaining parameter e (vector of length 1, finite positive integer).

Value

Calculated accuracy metric value (vector of length 1, numeric element). The lower the value, the better the accuracy, with 0 indicating perfect accuracy.

Examples

set.seed(1)

m <- 4
k <- 2

L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1)
sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2)
mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1)

n <- 100
data <- generate_data(n, L, sigma, mu)

Sigma <- L %*% t(L) + diag(sigma[1:(m + 1), ] ^ 2)
sigma_y_squared <- sigma[m + 2, ] ^ 2
Sigma[m + 1, m + 1] <- Sigma[m + 1, m + 1] + 2 * sigma_y_squared

factual_parameters <- list(Sigma, sigma_y_squared, mu)
estimated_parameters <- estimate_parameters(data, 0.00001)

evaluate_estimates(factual_parameters, estimated_parameters, n)


generate_data

Description

Generates data according to the single-output cumulative structural equation model with an additive-noise output measurement equation and assumptions of normality and independence, with given model parameter values.

Usage

generate_data(n, L, sigma, mu)

Arguments

n

The number of time moments to generate the data for (vector of length 1, finite positive integer).

L

Factor loadings ((m + 1) x k matrix of finite numeric elements: the first m rows correspond to the input measurement equation; the last row corresponds to the transition equation).

sigma

Standard deviations of the error/noise terms ((m + 2) x 1 matrix of finite non-negative numeric elements: the first m rows correspond to the input measurement equation; the row before the last one corresponds to the transition equation; the last row corresponds to the output measurement equation).

mu

Intercept terms ((m + 1) x 1 matrix of finite numeric elements: the first m rows correspond to the input measurement equation; the last row corresponds to the transition equation).

Value

An (n + 1) x (m + 1) data frame of numeric elements (except for row 1, columns 1 to m that contain NA's) containing observed input (columns 1 to m) and output (column m + 1) data.

Examples

set.seed(1)

m <- 4
k <- 2

L <- matrix(runif((m + 1) * k, min = -10, max = 10), nrow = m + 1)
sigma <- matrix(runif(m + 2, min = 0, max = 10), nrow = m + 2)
mu <- matrix(runif(m + 1, min = -10, max = 10), nrow = m + 1)
generate_data(10, L, sigma, mu)