lm.circular(..., type=c("c-c", "c-l"))
lm.circular.cc(y, x, order = 1, level = 0.05)
lm.circular.cl(y, x, init, verbose=FALSE, tol=1e-10)
## S3 method for class 'lm.circular.cl':
print(x, digits = max(3, getOption("digits") - 3), signif.stars= getOption("show.signif.stars"), ...)
lm.circular.cc
or to
lm.circular.cl
depending on the value of type
.type=="c-c"
then lm.circular.cc
is called
otherwise lm.circular.cl
is called.type="c-c"
or lm.circular.cc
is used otherwise a matrix
or a vector containing the independent linear variables.type="c-c"
.type="c-c"
.x
.TRUE
messages are printed while the
function is running.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
type=="c-c"
or lm.circular.cc
is called directly an
object of class lm.circular.cc
is returned with the following components:type=="c-l"
or lm.circular.cl
is called directly an
object of class lm.circular.cc
is returned with the following components: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).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.
# Generate a data set of dependent circular variables.
x <- circular(runif(50, 0, 2*pi))
y <- atan(0.15*cos(x) + 0.25*sin(x), 0.35*sin(x)) + rvonmises(n=50, mu=0,
kappa=5)
# Fit a circular-circular regression model.
circ.lm <- lm.circular(y, x, order=1)
# Obtain a crude plot a 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')
Run the code above in your browser using DataLab