clm {complex}R Documentation

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 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, ...)

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.

Details

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

Value

Function returns model - the final model of the class "clm", which contains:

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

References

See Also

alm

Examples


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


[Package complex version 1.0.0 Index]