| Title: | Time Series Analysis and Forecasting Using Complex Variables |
|---|---|
| Description: | Implements the instruments for complex-valued modelling, including time series analysis and forecasting. This is based on the monograph by Svetunkov & Svetunkov (2024) <doi:10.1007/978-3-031-62608-1>. |
| Authors: | Ivan Svetunkov [aut, cre] (Director of the OpenForecast consultancy company, UK, ORCID: <https://orcid.org/0000-0001-7826-0281>) |
| Maintainer: | Ivan Svetunkov <[email protected]> |
| License: | LGPL-2.1 |
| Version: | 1.0.3 |
| Built: | 2026-10-15 18:01:08 UTC |
| Source: | https://github.com/openforecast-org/complex |
Function selects the orders of complex ARIMA (see carima) based on an information criterion.
auto.carima(y, orders = list(ar = 3, i = 2, ma = 3), constant = NULL, ic = c("AICc", "AIC", "BIC", "BICc"), search = c("stepwise", "full"), distribution = c("dcnorm", "dcgnorm"), h = 0, holdout = FALSE, silent = TRUE, fast = FALSE, ...)auto.carima(y, orders = list(ar = 3, i = 2, ma = 3), constant = NULL, ic = c("AICc", "AIC", "BIC", "BICc"), search = c("stepwise", "full"), distribution = c("dcnorm", "dcgnorm"), h = 0, holdout = FALSE, silent = TRUE, fast = FALSE, ...)
y |
vector or ts object with the complex-valued time series. |
orders |
list of maximum orders |
constant |
if |
ic |
the information criterion used in the selection. |
search |
|
distribution |
the distribution used in the likelihood, see clm. |
h |
the forecast horizon. |
holdout |
if |
silent |
if |
fast |
if |
... |
The selection follows the principles of auto.ssarima: the AR and MA orders are
selected for each order of differencing, and the best model across all of them is chosen.
With search="stepwise":
For each from 0 to orders$i, the AR and MA orders are selected via a
neighbourhood search (similar to Hyndman & Khandakar, 2008): starting from cARIMA(0,d,0),
all models with p and q different by at most one are fitted, and the search moves to the best
of them, as long as the information criterion improves. If constant=NULL, the constant
is included for and excluded otherwise;
If constant=NULL, the best model of each is re-estimated with the opposite
option for the constant and the neighbourhood search continues from it. The best of all the
estimated models is returned.
With fast=TRUE, all cARIMA(p,d,q) with and without constant are first estimated via
the Hannan-Rissanen method (Hannan & Rissanen, 1982): the differences are regressed on their
lags and on the lags of the errors approximated by a long AR, via complex least squares. Their
information criteria are approximate. Then the best of them for each , constant and
MA order is estimated via the likelihood, and the neighbourhood search continues from the best
of these models (with its and constant). With heavy tails, the least squares used in the
screening is not efficient and tends to underrate the models with MA terms, which is why the best
model for each MA order is estimated. This is still an approximation: on wind data with heavy
tails, fast=TRUE selected a model with an information criterion worse by 16 than
the one found with fast=FALSE, while being about three times faster.
With search="full", all combinations of p, d, q and the constant are fitted
(except for cARIMA(p,0,q) without constant when constant=NULL).
Models with different orders of differencing and AR use different numbers of initial values,
which clm constructs from the data. To make the information criteria
comparable, all models are estimated on the whole sample, but their criteria are calculated on
the common sample without the first observations, where is the sum of the
maximum orders. The log-likelihood on that sample is calculated at the estimated parameters,
with the scale re-estimated.
Every model is estimated from the Hannan-Rissanen estimates of its parameters (see
fast in clm) and from the parameters of the closest model already
estimated (with zeros for the new parameters), and the one with the higher likelihood is kept.
The selected model of the class carima (see carima), with
additional elements:
ICs - data frame with the orders, the constant and the information criterion
(on the common sample) of all the models estimated in the process,
ic - the information criterion used,
icObsDropped - the number of first observations dropped for the criteria,
ICsScreening - with fast=TRUE, the approximate criteria of all the models
estimated via Hannan-Rissanen.
Ivan Svetunkov, [email protected]
Hannan, E. J., Rissanen, J. (1982). Recursive estimation of mixed autoregressive-moving average order. Biometrika, 69(1), 81-94.
Svetunkov, I., Boylan, J. E. (2019). State-space ARIMA for supply-chain forecasting. International Journal of Production Research, 58(3), 818-827.
Hyndman, R. J., Khandakar, Y. (2008). Automatic time series forecasting: the forecast package for R. Journal of Statistical Software, 27(3), 1-22.
carima, auto.ssarima,
auto.msarima
set.seed(41) e <- rcnorm(300, 0, sigma2=1, varsigma2=0.3+0.2i) y <- cumsum(e + c(0, (0.5-0.2i)*e[-300])) model <- auto.carima(y, orders=list(ar=2, i=1, ma=2)) model model$ICsset.seed(41) e <- rcnorm(300, 0, sigma2=1, varsigma2=0.3+0.2i) y <- cumsum(e + c(0, (0.5-0.2i)*e[-300])) model <- auto.carima(y, orders=list(ar=2, i=1, ma=2)) model model$ICs
The functions compute (and by default plot) estimates of the Complex Autocovariance, or Complex Autocorrelation, or Partial Complex Autocorrelation functions.
cacf(x, lag.max = NULL, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), type = c("correlation", "covariance", "partial"), plot = TRUE, ...) cpacf(x, lag.max = NULL, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), plot = TRUE, ...) ## S3 method for class 'cacf' print(x, ...) ## S3 method for class 'cacf' plot(x, which = c(1, 2), ask = length(which) > 1, level = 0.95, ...)cacf(x, lag.max = NULL, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), type = c("correlation", "covariance", "partial"), plot = TRUE, ...) cpacf(x, lag.max = NULL, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), plot = TRUE, ...) ## S3 method for class 'cacf' print(x, ...) ## S3 method for class 'cacf' plot(x, which = c(1, 2), ask = length(which) > 1, level = 0.95, ...)
x |
vector of complex variables. |
lag.max |
maximum number of lags. See acf for more details. |
method |
method to use in the calculation of the measure. |
type |
character string giving the type of cACF to be computed. Allowed values are "correlation" (the default) and "covariance". Will be partially matched. |
plot |
logical. If |
... |
Parameter for the plot() function. |
which |
Determines, which of the plots to produce. 1 is the plot of real and imaginary parts. 2 is the plot of absolute value and the argument. |
ask |
Determines, whether to ask before producing a new plot or not. |
level |
Confidence level for the non-rejection region of the correlation coefficient. |
For type="correlation" and "covariance", the estimates are based
on the sample pseudo covariance and use pseudo correlation ccor and complex
covariance ccov respectively. Note that the function does not calculate values for
lag 0. Also, the function will automatically remove NAs. Finally, function does not have
demean parameter (as, for example, is done in acf), because ccov()
and ccor() do that automatically.
cpacf() produces the partial complex ACF based on complex regression model of variable
on its lags.
The generic function plot has a method for objects of class "cacf".
The lag is returned and plotted in units of time, and not numbers of observations.
There is a print and plot methods for objects of class "cacf".
An object of class "cacf", which is a list with the following elements:
lag A three dimensional array containing the lags at which the cACF is estimated.
acf An array with the same dimensions as lag containing the estimated cACF.
method The method used in calculation (same as the method argument).
type The type of correlation (same as the type argument).
n.used The number of observations in the time series.
series The name of the series x.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Calculate cACF cacf(x)# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Calculate cACF cacf(x)
Function constructs complex ARIMA(p,d,q) model for a complex-valued time series, without explanatory variables. It is a wrapper of clm.
carima(y, orders = list(ar = 0, i = 0, ma = 0), constant = FALSE, arma = NULL, model = NULL, loss = c("likelihood", "OLS", "CLS", "MSE", "MAE", "HAM"), distribution = c("dcnorm", "dcgnorm"), h = 0, holdout = FALSE, silent = TRUE, ...) ## S3 method for class 'carima' forecast(object, h = 10, interval = c("none", "confidence", "prediction"), level = 0.95, ...)carima(y, orders = list(ar = 0, i = 0, ma = 0), constant = FALSE, arma = NULL, model = NULL, loss = c("likelihood", "OLS", "CLS", "MSE", "MAE", "HAM"), distribution = c("dcnorm", "dcgnorm"), h = 0, holdout = FALSE, silent = TRUE, ...) ## S3 method for class 'carima' forecast(object, h = 10, interval = c("none", "confidence", "prediction"), level = 0.95, ...)
y |
vector or ts object with the complex-valued time series. |
orders |
orders of the model: either a vector |
constant |
if |
arma |
list |
model |
previously estimated |
loss |
the loss function used in the estimation, see clm. |
distribution |
the distribution used in the likelihood, see clm. |
h |
the forecast horizon. If positive, the forecasts are produced and returned in
|
holdout |
if |
silent |
if |
... |
other parameters passed to clm, e.g. |
object |
the model estimated via |
interval |
the type of interval, see clm. |
level |
the confidence level for the prediction interval. |
The model is
where all the parameters are complex and is the constant (included only when
constant is not FALSE). With d>0 the constant acts as a drift.
Only the non-seasonal model is supported. Parameters are estimated via clm,
so its restrictions apply: the first lags are extrapolated and the first MA errors are set to
zero (there is no initial and no bounds). Fixed parameters (arma, numeric
constant) can only be provided for all of the parameters of the model at once.
An object of the class c("carima","clm","greybox"): the model returned by
clm, plus
orders - the list of orders,
constant - whether the constant is included,
h, holdout - the horizon and the holdout flag,
forecast - the point forecasts (if h>0),
holdoutData - the held-out values (if holdout=TRUE),
accuracy - the error measures on the holdout: real and imaginary parts of the
mean error (ME_r, ME_i), MAE (mean modulus of the error) and RMSE (root mean squared modulus
of the error).
Ivan Svetunkov, [email protected]
set.seed(41) e <- rcnorm(200, 0, sigma2=1, varsigma2=0.3+0.2i) y <- cumsum(e + c(0, 0.5*e[-200])) model <- carima(y, orders=c(0,1,1), h=10, holdout=TRUE) summary(model) model$accuracy forecast(model, h=5)set.seed(41) e <- rcnorm(200, 0, sigma2=1, varsigma2=0.3+0.2i) y <- cumsum(e + c(0, 0.5*e[-200])) model <- carima(y, orders=c(0,1,1), h=10, holdout=TRUE) summary(model) model$accuracy forecast(model, h=5)
Function estimates complex variables model
clm(formula, data, subset, na.action, loss = c("likelihood", "OLS", "CLS", "MSE", "MAE", "HAM"), distribution = c("dcnorm", "dcgnorm"), orders = c(0, 0, 0), scaling = c("normalisation", "standardisation", "max", "none"), parameters = NULL, fast = FALSE, ...) ## S3 method for class 'clm' sigma(object, type = NULL, ...) ## S3 method for class 'clm' vcov(object, type = NULL, ...) ## S3 method for class 'clm' summary(object, level = 0.95, ...)clm(formula, data, subset, na.action, loss = c("likelihood", "OLS", "CLS", "MSE", "MAE", "HAM"), distribution = c("dcnorm", "dcgnorm"), orders = c(0, 0, 0), scaling = c("normalisation", "standardisation", "max", "none"), parameters = NULL, fast = FALSE, ...) ## S3 method for class 'clm' sigma(object, type = NULL, ...) ## S3 method for class 'clm' vcov(object, type = NULL, ...) ## S3 method for class 'clm' summary(object, level = 0.95, ...)
formula |
an object of class "formula" (or one that can be coerced to
that class): a symbolic description of the model to be fitted. Can also include
|
data |
a data frame or a matrix, containing the variables in the model. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The factory-fresh default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful. |
loss |
The type of Loss Function used in optimization.
A user can also provide their own function here as well, making sure
that it accepts parameters
|
distribution |
the distribution used in the likelihood, when
|
orders |
vector of orders of complex ARIMA(p,d,q). |
scaling |
NOT YET IMPLEMENTED!!! Defines what type of scaling to do for the variables. See cscale for the explanation of the options. |
parameters |
vector of parameters of the linear model. When |
fast |
if |
... |
additional parameters to pass to distribution functions. This includes:
You can also pass parameters to the optimiser:
You can read more about these parameters by running the function nloptr.print.options. |
object |
Object of class "clm" estimated via |
type |
Type of sigma to return. This is calculated based on the residuals
of the estimated model and can be |
level |
What confidence level to use for the parameters of the model. |
This is a function, similar to lm, but supporting several estimation techniques for complex variables regression.
Function returns model - the final model of the class
"clm", which contains:
coefficients - estimated parameters of the model,
FI - Fisher Information of parameters of the model. Returned only when FI=TRUE,
fitted - fitted values,
residuals - residuals of the model,
mu - the estimated location parameter of the distribution,
scale - the estimated scale parameter of the distribution. If a formula was provided for scale, then an object of class "scale" will be returned.
logLik - log-likelihood of the model. Only returned, when loss="likelihood"
and in a special case of complex least squares.
loss - the type of the loss function used in the estimation,
lossFunction - the loss function, if the custom is provided by the user,
lossValue - the value of the loss function,
df.residual - number of degrees of freedom of the residuals of the model,
df - number of degrees of freedom of the model,
call - how the model was called,
rank - rank of the model,
data - data used for the model construction,
terms - terms of the data. Needed for some additional methods to work,
B - the value of the optimised parameters. Typically, this is a duplicate of coefficients,
other - the list of all the other parameters either passed to the
function or estimated in the process, but not included in the standard output
(e.g. alpha for Asymmetric Laplace),
timeElapsed - the time elapsed for the estimation of the model.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
### An example with mtcars data and factors x <- complex(real=rnorm(1000,10,10), imaginary=rnorm(1000,10,10)) a0 <- 10 + 15i a1 <- 2-1.5i y <- a0 + a1 * x + 1.5*complex(real=rnorm(length(x),0,1), imaginary=rnorm(length(x),0,1)) complexData <- cbind(y=y,x=x) complexModel <- clm(y~x, complexData) summary(complexModel) plot(complexModel, 7)### An example with mtcars data and factors x <- complex(real=rnorm(1000,10,10), imaginary=rnorm(1000,10,10)) a0 <- 10 + 15i a1 <- 2-1.5i y <- a0 + a1 * x + 1.5*complex(real=rnorm(length(x),0,1), imaginary=rnorm(length(x),0,1)) complexData <- cbind(y=y,x=x) complexModel <- clm(y~x, complexData) summary(complexModel) plot(complexModel, 7)
Function clog() will take logarithm of real and imaginary parts separately
and then merge the resulting variable in the complex one. The function
cexp() does the opposite transform, taking exponent of parts and then
merging them.
clog(y, base = exp(1)) cexp(y, base = exp(1))clog(y, base = exp(1)) cexp(y, base = exp(1))
y |
vector of a complex variable in the original scale. |
base |
a positive or complex number: the base with respect to which logarithms/powers are computed. Defaults to exp(1). |
A vector of the same size as y, containing transformed complex variable.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables y <- complex(real=rnorm(100,100,10), imaginary=rnorm(100,100,10)) yLog <- clog(y) cexp(yLog)# Generate random complex variables y <- complex(real=rnorm(100,100,10), imaginary=rnorm(100,100,10)) yLog <- clog(y) cexp(yLog)
complex2mat() constructs a matrix from the provided complex variable,
while complex2vec() returns a vector (in mathematical sense), both of them
split the real and imaginary parts. mat2complex() and vec2complex() do
the reverse of the respective functions. See details for explanation.
complex2mat(x) complex2vec(x) mat2complex(x) vec2complex(x)complex2mat(x) complex2vec(x) mat2complex(x) vec2complex(x)
x |
vector or matrix of complex variables. |
Complex variable x + iy can be represented as a vector (x y)' or as a matrix: (x -y) (y x)
complex2mat() returns the latter, while complex2vec() returns the
former. If a user provides a vector of complex variables, the values are stacked above
each other. If a matrix is provided, a higher dimensional matrix is returned.
mat2complex() and vec2complex() return complex variables based on provided
matrix.
The function is needed to calculate some statistics for complex variables in vector form.
A matrix with real and imaginary parts of x split into columns (and rows in case
of complex2mat()).
#' @references
Svetunkov, S. & Svetunkov I (2022) Complex Autoregressions. In Press.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Get a matrix and a vector for one value complex2mat(x[1]) complex2vec(x[1]) # Get matrices for all values complex2mat(x) complex2vec(x)# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Get a matrix and a vector for one value complex2mat(x[1]) complex2vec(x[1]) # Get matrices for all values complex2mat(x) complex2vec(x)
Function produces six scatterplots to show relations between the two complex variables x and y.
cplot(x, y, which = 1, ...)cplot(x, y, which = 1, ...)
x |
vector of a complex variable. |
y |
second vector of a complex variable. |
which |
defines, what type of plot to produce. |
... |
otehr parameters passed to plot method. Works only for |
The plots are positioned to satisfy two rules: 1. When a scatterplot for a c.r.v. is produced, the real part should be in x-axis, while the imaginary should be in the y-axis. 2. When parts of variables x and y are compared, the part for $x$ should be in x-axis, while the part for y should be in y-axis, which should the reflect the idea that x could be an explanatory variable for y.
The function produces a plot and does not return any value
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) cplot(x, y)# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) cplot(x, y)
Function cscale() will do the scaling based on the selected method, while
the function cdescale() will transform the variable to get to the
original units.
cscale(y, scaling = c("normalisation", "standardisation", "max")) cdescale(yScaled, y, scaling = c("normalisation", "standardisation", "max"))cscale(y, scaling = c("normalisation", "standardisation", "max")) cdescale(yScaled, y, scaling = c("normalisation", "standardisation", "max"))
y |
vector of a complex variable in the original scale. |
scaling |
scaling method to use. "normalisation" implies scaling
to make sure that |
yScaled |
vector of the already scaled complex variable. |
A vector of the same size as y, containing scaled complex variable.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) yScaled <- cscale(y) cdescale(yScaled, y)# Generate random complex variables y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) yScaled <- cscale(y) cdescale(yScaled, y)
Functions cvar(), ccov() and ccor() return respectively
complex variance, covariance and correlation based on the
provided complex vector/matrix x. Function covar() returns the covariance
matrix based on a complex vector/matrix.
cvar(x, method = c("direct", "conjugate"), df = NULL, ...) ccov(x, y, method = c("direct", "conjugate"), df = NULL, ...) ccor(x, y, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), ...) ccov2cor(V) covar(x, df = NULL)cvar(x, method = c("direct", "conjugate"), df = NULL, ...) ccov(x, y, method = c("direct", "conjugate"), df = NULL, ...) ccor(x, y, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), ...) ccov2cor(V) covar(x, df = NULL)
x |
vector or matrix of complex variables. If it is matrix then the
variable |
method |
method to use in the calculation of the measure. |
df |
Number of degrees of freedom to use in the calculation of the statistics. |
... |
parameters passed to |
y |
second vector to calculate covariance or correlations with. |
V |
complex (pseudo)covariance matrix. |
Only the parametric correlation is supported by the function. If x
is matrix, then y is ignored.
covar() function returns a covariance matrix calculated for the provided complex
vector or matrix x.
A scalar or a matrix with resulting complex variables.
Ivan Svetunkov, [email protected]
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Create a matrix of complex variables z <- cbind(x,y) # Calculate measures cvar(x) cvar(z) ccor(x,y) ccor(z)# Generate random complex variables x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10)) # Create a matrix of complex variables z <- cbind(x,y) # Calculate measures cvar(x) cvar(z) ccor(x,y) ccor(z)
Density and random generation for the complex generalised normal distribution
(also known as the complex generalised Gaussian or the bivariate exponential power
distribution) with location mu, scale scale, pseudo-scale
pseudoscale and shape shape.
dcgnorm(q, mu = 0, scale = 1, pseudoscale = 0, shape = 1, log = FALSE) rcgnorm(n = 1, mu = 0, scale = 1, pseudoscale = 0, shape = 1)dcgnorm(q, mu = 0, scale = 1, pseudoscale = 0, shape = 1, log = FALSE) rcgnorm(n = 1, mu = 0, scale = 1, pseudoscale = 0, shape = 1)
q |
vector of quantiles (complex). |
mu |
vector of location parameters (complex). |
scale |
scale parameter (real, positive). |
pseudoscale |
pseudo-scale parameter (complex, with the modulus smaller than scale). |
shape |
shape parameter (real, positive). |
log |
if |
n |
number of observations. Should be a single number. |
For the error term , the density is
where ,
is the scale, is the pseudo-scale and is the shape.
With shape=1 this is the complex normal distribution with variance scale and
pseudo-variance pseudoscale (see dcnorm). Values of shape below one
give heavier tails (shape=0.5 is Laplace-like), values above one give lighter tails
(the uniform distribution on an ellipse in the limit). Note that the shape here applies to
the quadratic form, so shape=1 corresponds to shape=2 in
dgnorm.
The variance and the pseudo-variance of the distribution equal scale and
pseudoscale multiplied by .
Random numbers are generated using the fact that follows the Gamma distribution
with shape and scale 2, and the angle is uniform in the standardised space.
dcgnorm returns the density, rcgnorm returns a vector of
complex random values.
Ivan Svetunkov, [email protected]
Novey, M., Adali, T., Roy, A. (2010). A complex generalized Gaussian distribution - characterization, generation, and estimation. IEEE Transactions on Signal Processing, 58(3), 1427-1433.
Gomez, E., Gomez-Villegas, M. A., Marin, J. M. (1998). A multivariate generalization of the power exponential family of distributions. Communications in Statistics - Theory and Methods, 27(3), 589-600.
x <- rcgnorm(1000, 1+1i, scale=2, pseudoscale=0.6+0.8i, shape=0.5) plot(x) dcgnorm(x[1:5], 1+1i, scale=2, pseudoscale=0.6+0.8i, shape=0.5)x <- rcgnorm(1000, 1+1i, scale=2, pseudoscale=0.6+0.8i, shape=0.5) plot(x) dcgnorm(x[1:5], 1+1i, scale=2, pseudoscale=0.6+0.8i, shape=0.5)
Density, cumulative distribution, quantile functions and random number generation for the Complex Normal distribution.
dcnorm(q, mu = 0, sigma2 = 1, varsigma2 = 0, log = FALSE, ...) pcnorm(lower = -Inf, upper = Inf, mu = 0, sigma2 = 1, varsigma2 = 0, ...) qcnorm(p, mu = 0, sigma2 = 1, varsigma2 = 0, ...) rcnorm(n = 1, mu = 0, sigma2 = 1, varsigma2 = 0, ...)dcnorm(q, mu = 0, sigma2 = 1, varsigma2 = 0, log = FALSE, ...) pcnorm(lower = -Inf, upper = Inf, mu = 0, sigma2 = 1, varsigma2 = 0, ...) qcnorm(p, mu = 0, sigma2 = 1, varsigma2 = 0, ...) rcnorm(n = 1, mu = 0, sigma2 = 1, varsigma2 = 0, ...)
q |
vector of quantiles. |
mu |
vector of location parameters (means). |
sigma2 |
vector of conjugate variances. |
varsigma2 |
vector of direct variances. |
log |
if |
... |
Other parameters passed to the |
lower |
complex number of lower limits of length n. |
upper |
complex number of upper limits of length n. |
p |
vector of probabilities. |
n |
number of observations. Should be a single number. |
Complex Normal distribution is a special case of a multivariate normal distribution, which is parametrised using direct and conjugate variances instead of the covariance matrix.
These functions are just wrappers for the functions from the mvtnorm
package.
Note that sigma2 and varsigma2 are the conjugate and direct
variances, not the standard deviations!
Both pcnorm and qcnorm are returned for the lower
tail of the distribution.
All the functions are defined for non-negative values only.
Depending on the function, various things are returned (usually either vector or scalar):
dcnorm returns the density function values for the
provided parameters, based on Mvnorm function.
pcnorm returns the values of the cumulative function
for the provided parameters, based on pmvnorm function.
qcnorm returns quantiles of the distribution,
based on qmvnorm function.
rcnorm returns a vector of random variables
generated from the Complex Normal distribution,
based on Mvnorm function.
Ivan Svetunkov, [email protected]
dcnorm(89+90i, 100+100i, 2, 1+1i) pcnorm(90+90i, 110+110i, 100+100i, 2, 1+1i) qcnorm(0.95, 100+100i, 2, 1+1i) rcnorm(1000, 100+100i, 2, 1+1i)dcnorm(89+90i, 100+100i, 2, 1+1i) pcnorm(90+90i, 110+110i, 100+100i, 2, 1+1i) qcnorm(0.95, 100+100i, 2, 1+1i) rcnorm(1000, 100+100i, 2, 1+1i)
The function accepts a square complex matrix and returns inverse of it.
invert(x)invert(x)
x |
The square matrix of complex variables. |
The function returns a matrix of the same size as the original
matrix x
Ivan Svetunkov, [email protected]
invert(matrix(complex(real=c(1,2), imaginary=c(1.1,2.1)), 2, 2))invert(matrix(complex(real=c(1,2), imaginary=c(1.1,2.1)), 2, 2))