lm.circular: Circular-Circular and Circular-Linear Regression

Description Usage Arguments Details Value Author(s) References Examples

View source: R/lm.circular.R

Description

Fits a regression model for a circular dependent and circular independent variable or for a circular dependent and linear independent variables.

Usage

1
2
3
4
5
6
7
lm.circular(..., type=c("c-c", "c-l"))
lm.circular.cc(y, x, order = 1, level = 0.05, control.circular = list())
lm.circular.cl(y, x, init = NULL, verbose = FALSE, tol = 1e-10, 
  control.circular = list())
## S3 method for class 'lm.circular.cl'
print(x, digits = max(3, getOption("digits") - 3), 
  signif.stars= getOption("show.signif.stars"), ...)

Arguments

...

arguments passed to lm.circular.cc or to lm.circular.cl depending on the value of type.

type

if type=="c-c" then lm.circular.cc is called otherwise lm.circular.cl is called.

y

vector of data for the dependent circular variable.

x

vector of data for the independent circular variable if type="c-c" or lm.circular.cc is used otherwise a matrix or a vector containing the independent linear variables.

order

order of trigonometric polynomial to be fit. Order must be an integer value. By default, order=1. Used if type="c-c".

level

level of the test for the significance of higher order trigonometric terms. Used if type="c-c".

control.circular

the attribute of the resulting objects (fitted, residuals components in the case of type=="c-c" and mu and se.mu) otherwise.

init

a vector with initial values of length equal to the columns of x.

verbose

logical: if TRUE messages are printed while the function is running.

tol

the absolute accuracy to be used to achieve convergence of the algorithm.

digits

the number of digits to be printed.

signif.stars

logical; if TRUE, P-values are additionally encoded visually as “significance stars” in order to help scanning of long coefficient tables. It defaults to the show.signif.stars slot of options.

Details

If type=="c-c" or lm.circular.cc is called directly a trigonometric polynomial of x is fit against the cosine and sine of y. The order of trigonometric polynomial is specified by order. Fitted values of y are obtained by taking the inverse tangent of the predicted values of sin(y) devided by the predicted values of cos(y). Details of the regression model can be found in Sarma and Jammalamadaka (1993).

If type=="c-l" or lm.circular.cl is called directly, this function implements the homoscedastic version of the maximum likelihood regression model proposed by Fisher and Lee (1992). The model assumes that a circular response variable theta has a von Mises distribution with concentration parameter kappa, and mean direction related to a vector of linear predictor variables according to the relationship: mu + 2*atan(beta'*x), where mu and beta are unknown parameters, beta being a vector of regression coefficients. The function uses Green's (1984) iteratively reweighted least squares algorithm to perform the maximum likelihood estimation of kappa, mu, and beta. Standard errors of the estimates of kappa, mu, and beta are estimated via large-sample asymptotic variances using the information matrix. An estimated circular standard error of the estimate of mu is then obtained according to Fisher and Lewis (1983, Example 1).

Value

If type=="c-c" or lm.circular.cc is called directly an object of class lm.circular.cc is returned with the following components:

call

the match.call result.

rho

square root of the average of the squares of the estimated conditional concentration parameters of y given x.

fitted

fitted values of the model of class circular.

data

matrix whose columns correspond to x and y.

residuals

circular residuals of the model of class circular.

coefficients

matrix whose entries are the estimated coefficients of the model. The first column corresponds to the coefficients of the model predicting the cosine of y, while the second column contains the estimates for the model predicting the sine of y. The rows of the matrix correspond to the coefficients according to increasing trigonometric order.

p.values

p-values testing whether the (order + 1) trigonometric terms are significantly different from zero.

A.k

is mean of the cosines of the circular residuals.

kappa

assuming the circular residuals come from a von Mises distribution, kappa is the MLE of the concentration parameter.

If type=="c-l" or lm.circular.cl is called directly an object of class lm.circular.cc is returned with the following components:

call

the match.call result.

x

the independent variables.

y

the dependent variable.

mu

the circular mean of the dependent variable of class circular.

se.mu

an estimated standard error of the circular mean with the same units of measure used for mu.

kappa

the concentration parameter for the dependent variable.

se.kappa

an estimated standard error of the concentration parameter.

coefficients

the estimated coefficients.

cov.coef

covariance matrix of the estimated coefficients.

se.coef

standard errord of the estimated coefficients.

log.lik

log-likehood.

t.values

values of the t statistics for the coefficients.

p.values

p-values of the t statistics. Approximated values using Normal distribution.

Author(s)

Claudio Agostinelli and Ulric Lund

References

Fisher, N. and Lee, A. (1992). Regression models for an angular response. Biometrics, 48, 665-677.

Fisher, N. and Lewis, T. (1983). Estimating the common mean direction of several circular or spherical distributions with different dispersions. Biometrika, 70, 333-341.

Green, P. (1984). Iteratively reweighted least squares for maximum likelihood estimation, and some robust and resistant alternatives. Journal of the Royal Statistical Society, B, 46, 149-192.

Jammalamadaka, S. Rao and SenGupta, A. (2001). Topics in Circular Statistics, Section 8.3, World Scientific Press, Singapore.

Sarma, Y. and Jammalamadaka, S. (1993). Circular Regression. Statistical Science and Data Analysis, 109-128. Proceeding of the Thrid Pacific Area Statistical Conference. VSP: Utrecht, Netherlands.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Generate a data set of dependent circular variables.
x <- circular(runif(50, 0, 2*pi))
y <- atan2(0.15*cos(x) + 0.25*sin(x), 0.35*sin(x)) + 
  rvonmises(n=50, mu=circular(0), kappa=5)

# Fit a circular-circular regression model.
circ.lm <- lm.circular(y, x, order=1)
# Obtain a crude plot of the data and fitted regression line.
plot.default(x, y)
circ.lm$fitted[circ.lm$fitted>pi] <- circ.lm$fitted[circ.lm$fitted>pi] - 2*pi 

points.default(x[order(x)], circ.lm$fitted[order(x)], type='l')


# Fit a circular-linear regression model.
set.seed(1234)
x <- cbind(rnorm(10), rep(1, 10))
y <- circular(2*atan(c(x%*%c(5,1))))+rvonmises(10, mu=circular(0), kappa=100)
lm.circular(y=y, x=x, init=c(5,1), type='c-l', verbose=TRUE)

Example output

Attaching package: 'circular'

The following objects are masked from 'package:stats':

    sd, var

Iteration  1 :    Log-Likelihood =  24.56042 
Iteration  2 :    Log-Likelihood =  24.56847 
Iteration  3 :    Log-Likelihood =  24.57257 
Iteration  4 :    Log-Likelihood =  24.57465 
Iteration  5 :    Log-Likelihood =  24.5757 
Iteration  6 :    Log-Likelihood =  24.57622 
Iteration  7 :    Log-Likelihood =  24.57649 
Iteration  8 :    Log-Likelihood =  24.57662 
Iteration  9 :    Log-Likelihood =  24.57669 
Iteration  10 :    Log-Likelihood =  24.57672 
Iteration  11 :    Log-Likelihood =  24.57674 
Iteration  12 :    Log-Likelihood =  24.57675 
Iteration  13 :    Log-Likelihood =  24.57675 
Iteration  14 :    Log-Likelihood =  24.57675 
Iteration  15 :    Log-Likelihood =  24.57675 
Iteration  16 :    Log-Likelihood =  24.57675 
Iteration  17 :    Log-Likelihood =  24.57676 
Iteration  18 :    Log-Likelihood =  24.57676 
Iteration  19 :    Log-Likelihood =  24.57676 
Iteration  20 :    Log-Likelihood =  24.57676 
Iteration  21 :    Log-Likelihood =  24.57676 
Iteration  22 :    Log-Likelihood =  24.57676 
Iteration  23 :    Log-Likelihood =  24.57676 
Iteration  24 :    Log-Likelihood =  24.57676 
Iteration  25 :    Log-Likelihood =  24.57676 
Iteration  26 :    Log-Likelihood =  24.57676 
Iteration  27 :    Log-Likelihood =  24.57676 
Iteration  28 :    Log-Likelihood =  24.57676 
Iteration  29 :    Log-Likelihood =  24.57676 
Iteration  30 :    Log-Likelihood =  24.57676 
Iteration  31 :    Log-Likelihood =  24.57676 
Iteration  32 :    Log-Likelihood =  24.57676 
Iteration  33 :    Log-Likelihood =  24.57676 
Iteration  34 :    Log-Likelihood =  24.57676 
Iteration  35 :    Log-Likelihood =  24.57676 
Iteration  36 :    Log-Likelihood =  24.57676 
Iteration  37 :    Log-Likelihood =  24.57676 
Iteration  38 :    Log-Likelihood =  24.57676 
Iteration  39 :    Log-Likelihood =  24.57676 
Iteration  40 :    Log-Likelihood =  24.57676 
Iteration  41 :    Log-Likelihood =  24.57676 
Iteration  42 :    Log-Likelihood =  24.57676 
Iteration  43 :    Log-Likelihood =  24.57676 
Iteration  44 :    Log-Likelihood =  24.57676 
Iteration  45 :    Log-Likelihood =  24.57676 
Iteration  46 :    Log-Likelihood =  24.57676 
Iteration  47 :    Log-Likelihood =  24.57676 
Iteration  48 :    Log-Likelihood =  24.57676 
Iteration  49 :    Log-Likelihood =  24.57676 
Iteration  50 :    Log-Likelihood =  24.57676 
Iteration  51 :    Log-Likelihood =  24.57676 
Iteration  52 :    Log-Likelihood =  24.57676 
Iteration  53 :    Log-Likelihood =  24.57676 
Iteration  54 :    Log-Likelihood =  24.57676 
Iteration  55 :    Log-Likelihood =  24.57676 
Iteration  56 :    Log-Likelihood =  24.57676 
Iteration  57 :    Log-Likelihood =  24.57676 

Call:
lm.circular.cl(y = ..1, x = ..2, init = ..3, verbose = TRUE)


 Circular-Linear Regression 

 Coefficients:
     Estimate Std. Error t value Pr(>|t|)    
[1,]   5.1566     0.4184  12.325  < 2e-16 ***
[2,]   1.1203     0.2342   4.783 8.64e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

 Log-Likelihood:  24.58 

 Summary: (mu in radians)
  mu:  -0.08114 ( 0.04603 )  kappa:  59.5 ( 26.5 )
p-values are approximated using normal distribution

circular documentation built on July 4, 2017, 9:03 a.m.