Learn R Programming

complex (version 1.0.0)

clm: Complex Linear Model

Description

Function estimates complex variables model

Usage

clm(formula, data, subset, na.action, loss = c("likelihood", "OLS", "CLS",
  "MSE", "MAE", "HAM"), orders = c(0, 0, 0), scaling = c("normalisation",
  "standardisation", "max", "none"), parameters = NULL, fast = FALSE, ...)

# S3 method for clm sigma(object, type = NULL, ...)

# S3 method for clm vcov(object, type = NULL, ...)

# S3 method for clm summary(object, level = 0.95, ...)

Value

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.

Arguments

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 trend, which would add the global trend.

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. loss can be:

  • OLS - Ordinary Least Squares method, relying on the minimisation of the conjoint variance of the error term;

  • CLS - Complex Least Squares method, relying on the minimisation of the complex variance of the error term;

  • likelihood - the model is estimated via the maximisation of the likelihood of the complex Normal distribution;

  • MSE (Mean Squared Error),

  • MAE (Mean Absolute Error),

  • HAM (Half Absolute Moment),

A user can also provide their own function here as well, making sure that it accepts parameters actual, fitted and B. Here is an example:

lossFunction <- function(actual, fitted, B, xreg) return(mean(abs(actual-fitted))) loss=lossFunction

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 NULL, it is estimated.

fast

if TRUE, then the function won't check whether the data has variability and whether the regressors are correlated. Might cause trouble, especially in cases of multicollinearity.

...

Other parameters passed to internal functions.

object

Object of class "clm" estimated via clm() function.

type

Type of sigma to return. This is calculated based on the residuals of the estimated model and can be "direct", based on the direct variance, "conjugate", based on the conjugate variance and "matrix", returning covariance matrix for the complex error. If NULL then will return value based on the loss used in the estimation: OLS -> "conjugate", CLS -> "direct", likelihood -> "matrix".

level

What confidence level to use for the parameters of the model.

Author

Ivan Svetunkov, ivan@svetunkov.ru

Details

This is a function, similar to lm, but supporting several estimation techniques for complex variables regression.

References

  • Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.

See Also

alm

Examples

Run this code

### 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)

Run the code above in your browser using DataLab