| Title: | Circular Regression Models |
|---|---|
| Description: | Implements regression models for circular response data, including homogeneous angular regression, consensus angular regression, a two-step workflow, selected special-case model wrappers, and a random-intercept extension for clustered circular outcomes. |
| Authors: | Aurelien Nicosia [aut, cre] |
| Maintainer: | Aurelien Nicosia <[email protected]> |
| License: | GPL-3 |
| Version: | 0.5.0 |
| Built: | 2026-06-11 10:26:37 UTC |
| Source: | https://github.com/aureliennicosiaulaval/circularregression |
Fits the homogeneous angular regression model of Rivest et al. (2016), where the mean direction is the orientation of a weighted resultant vector and one reference angle has coefficient fixed to 1.
angular( formula, data, reference = c("auto", "first", "name"), initbeta = NULL, control = list(), na.action = stats::na.omit )angular( formula, data, reference = c("auto", "first", "name"), initbeta = NULL, control = list(), na.action = stats::na.omit )
formula |
A formula with terms of the form |
data |
A data frame, list or environment containing model variables. |
reference |
Reference-angle rule. Use |
initbeta |
Optional numeric vector of initial values for non-reference coefficients. |
control |
Control list with optional components |
na.action |
Function used by |
An object of class "angular".
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
Computes the statistic from Rivest et al. (2016), Section 3.6:
where model 1 is the full model and model 0 the nested reduced model.
angular_lrtest(full, reduced, check = TRUE)angular_lrtest(full, reduced, check = TRUE)
full |
Object of class |
reduced |
Object of class |
check |
Logical; perform consistency checks. |
An object of class "htest".
Fits the homogeneous angular regression of Rivest et al. (2016) augmented
with a cluster-specific random intercept
and unit-errors , following Rivest
& Kato (2019). The fixed-effects component shares the simplified syntax of
angular(), where the first term provides the reference direction and
subsequent terms are written x:z.
angular_re( formula, data, cluster, init = list(), control = list(), na.action = stats::na.omit )angular_re( formula, data, cluster, init = list(), control = list(), na.action = stats::na.omit )
formula |
Model formula with a circular response and terms of the form
|
data |
A data frame containing the variables used in |
cluster |
Factor or vector of cluster identifiers. It must have length
equal to |
init |
Optional list with components |
control |
Optional list controlling the optimisation with components
|
na.action |
Function used by |
An object of class "angular_re" containing fixed-effect
estimates, model-based and cluster-robust covariance matrices, concentration
estimates, fitted marginal mean directions, fixed and conditional
residuals, and estimated random intercepts.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
Rivest, L.-P., and Kato, S. (2019). A random-effects model for clustered circular data. Canadian Journal of Statistics, 47(4), 712-728.
data(Sandhopper) sh <- Sandhopper[seq_len(24), ] sh$y <- sh$LN1 * pi / 180 sh$ref <- sh$Azimuth * pi / 180 sh$wind <- sh$DirW * pi / 180 sh$wind_speed <- sh$SpeedW / max(sh$SpeedW, na.rm = TRUE) fit <- angular_re( y ~ ref + wind:wind_speed, data = sh, cluster = sh$Anim, control = list(maxit = 25, reltol = 1e-6) ) coef(fit) head(predict(fit))data(Sandhopper) sh <- Sandhopper[seq_len(24), ] sh$y <- sh$LN1 * pi / 180 sh$ref <- sh$Azimuth * pi / 180 sh$wind <- sh$DirW * pi / 180 sh$wind_speed <- sh$SpeedW / max(sh$SpeedW, na.rm = TRUE) fit <- angular_re( y ~ ref + wind:wind_speed, data = sh, cluster = sh$Anim, control = list(maxit = 25, reltol = 1e-6) ) coef(fit) head(predict(fit))
Implements the strategy recommended by Rivest et al. (2016): fit the consensus model first, choose the reference angle, then fit the homogeneous model with the reference fixed and initialized from consensus ratios.
angular_two_step( formula, data, weights = NULL, reference = c("auto", "first", "name"), control_consensus = list(), control_angular = list(), na.action = stats::na.omit )angular_two_step( formula, data, weights = NULL, reference = c("auto", "first", "name"), control_consensus = list(), control_angular = list(), na.action = stats::na.omit )
formula |
Model formula with terms of the form |
data |
Data frame containing model variables. |
weights |
Optional non-negative weights passed to |
reference |
Reference-angle rule for the homogeneous step:
|
control_consensus |
Control list for |
control_angular |
Control list for |
na.action |
Function used by |
An object of class "angular_two_step".
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
This function augments a data frame with lagged versions of an angular response variable so that autoregressive circular regression models can be fitted.
autoregressivedata(data, response, p, ID = NULL)autoregressivedata(data, response, p, ID = NULL)
data |
A data frame containing at least the response variable. |
response |
A character string specifying the name of the angular response variable. |
p |
Integer giving the order of the autoregressive structure. |
ID |
Optional. A character string specifying the name of a grouping variable. If provided, lags are computed within each group. |
The input data with p additional columns named response_tmk for containing the lagged values of response.
A subset of the bison movement dataset used for illustrating angular
regression models of the form , where 'x.*'
denote angular covariates (target directions) and 'z.*' the corresponding
positive covariates (weights) in the product x:z. The data originate
from GPS-tracked bison trajectories and environmental variables describing
landscape features such as meadows and canopy gaps.
bisonbison
A data frame with 5,696 rows and 7 columns:
Direction of movement at time .
Direction of movement at time .
Direction of movement at time .
Angle toward the nearest meadow.
Distance toward the nearest meadow associated with x.meadow.
Angle toward the nearest canopy gap.
Distance toward the nearest canopy gap associated with x.gap.
All angular variables in this processed dataset are stored in radians.
This reduced dataset is designed to work directly with the functions of the
CircularRegression package implementing the general angular regression
model of Rivest et al. (2016). Each x:z pair represents a weighted
target direction contributing to the mean resultant vector
, where z.* modulates the
attraction toward the angular covariate x.*. Variables
y.prec and y.prec2 can be included to model directional
persistence between successive movement steps.
Ecologically, these variables describe the orientation of bison movement relative to attractive features in the landscape: open meadows and canopy gaps. The dataset serves as a clean example for model testing, illustration, and teaching applications involving directional movement analysis.
The repository does not include the raw GPS files or a full reconstruction script for this processed dataset. The package maintainer has confirmed that this processed package dataset may be redistributed with the package.
Reduced package dataset derived from the bison movement application described by Rivest et al. (2016). The repository does not include raw GPS files or a reconstruction script for this reduced teaching dataset.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
angular, consensus, pick_reference_angle
# View structure str(bison)# View structure str(bison)
circular_regression() is the recommended high-level interface for
fixed-effect circular regression models in this package. It keeps the
existing model-specific functions available while providing a common,
glm()-like entry point for the homogeneous angular model, the
consensus model, and the two-step workflow.
circular_regression( formula, data, method = c("two_step", "homogeneous", "consensus"), weights = NULL, reference = c("auto", "first", "name"), control = list(), control_consensus = list(), control_angular = list(), na.action = stats::na.omit, ... )circular_regression( formula, data, method = c("two_step", "homogeneous", "consensus"), weights = NULL, reference = c("auto", "first", "name"), control = list(), control_consensus = list(), control_angular = list(), na.action = stats::na.omit, ... )
formula |
Model formula with a circular response on the left-hand side
and explanatory direction terms on the right-hand side. Terms must be of
the form |
data |
Data frame, list, or environment containing model variables. |
method |
Model fitting strategy. |
weights |
Optional non-negative observation weights. Used by
|
reference |
Reference-angle rule for homogeneous fits. Use
|
control |
Optional control list passed to the selected model. For
|
control_consensus |
Control list for the consensus step. |
control_angular |
Control list for the homogeneous step. |
na.action |
Function used by |
... |
Additional arguments passed to the underlying model-specific function. |
An object of class "circular_regression" containing the fitted
model, the method used, the original call, and the formula.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
data(bison) d <- bison[seq_len(100), ] fit <- circular_regression( y.dir ~ y.prec + x.meadow:z.meadow, data = d ) coef(fit) head(predict(fit))data(bison) d <- bison[seq_len(100), ] fit <- circular_regression( y.dir ~ y.prec + x.meadow:z.meadow, data = d ) coef(fit) head(predict(fit))
Fits the consensus model of Rivest et al. (2016), where each formula term of
the form x or x:z receives a coefficient in the
log-likelihood parameterization.
consensus( formula, data, weights = NULL, initkappa = NULL, initbeta = NULL, control = list(), na.action = stats::na.omit )consensus( formula, data, weights = NULL, initkappa = NULL, initbeta = NULL, control = list(), na.action = stats::na.omit )
formula |
Model formula containing terms of the form |
data |
Data frame, list or environment containing model variables. |
weights |
Optional non-negative weights. |
initkappa |
Optional numeric vector of initial |
initbeta |
Deprecated alias for |
control |
Optional list with |
na.action |
Function used by |
An object of class "consensus".
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
Fits the decentered-predictor special case by augmenting the data with
synthetic orthogonal directions and applying angular_two_step().
Natural parameters are returned with model-based and robust delta-method
standard errors.
decentredPredictorModel(data, response, w, ...)decentredPredictorModel(data, response, w, ...)
data |
A data frame containing |
response |
Name of the angular response variable. |
w |
Name of the angular explanatory variable. |
... |
Additional arguments passed to |
A list with consensus_fit, homogeneous_fit,
reference, data_aug, formula, and natural-parameter
outputs natural_parameters, natural_vcov_model,
natural_vcov_robust, natural_jacobian.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
data(bison) d <- na.omit(bison[seq_len(80), c("y.dir", "y.prec")]) fit <- decentredPredictorModel(d, response = "y.dir", w = "y.prec") fit$natural_parametersdata(bison) d <- na.omit(bison[seq_len(80), c("y.dir", "y.prec")]) fit <- decentredPredictorModel(d, response = "y.dir", w = "y.prec") fit$natural_parameters
Fits the Jammalamadaka-Sengupta special case by creating the required sine/cosine-equivalent angular terms and returning the corresponding natural parameters through a delta-method transformation.
jammalamadakaModel(data, response, w, ...)jammalamadakaModel(data, response, w, ...)
data |
A data frame containing |
response |
Name of the angular response variable. |
w |
Name of the angular explanatory variable. |
... |
Additional arguments passed to |
A list with consensus_fit, homogeneous_fit,
reference, data_aug, formula, and natural-parameter
outputs natural_parameters, natural_vcov_model,
natural_vcov_robust, natural_jacobian.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
data(bison) d <- na.omit(bison[seq_len(80), c("y.dir", "y.prec")]) fit <- jammalamadakaModel(d, response = "y.dir", w = "y.prec") fit$natural_parametersdata(bison) d <- na.omit(bison[seq_len(80), c("y.dir", "y.prec")]) fit <- jammalamadakaModel(d, response = "y.dir", w = "y.prec") fit$natural_parameters
Fits the mean-direction special case through the same two-step workflow used
by angular_two_step(). The wrapper creates synthetic reference
directions internally and returns natural-parameter summaries obtained by a
delta-method transformation of the homogeneous fit.
meanDirectionModel(data, response, mu0 = NULL, ...)meanDirectionModel(data, response, mu0 = NULL, ...)
data |
A data frame containing at least the response variable. |
response |
Name of the angular response variable. |
mu0 |
Optional finite numeric scalar or vector of length
|
... |
Additional arguments passed to |
A list with consensus_fit, homogeneous_fit,
reference, data_aug, formula, and natural-parameter
outputs natural_parameters, natural_vcov_model,
natural_vcov_robust, natural_jacobian.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
data(bison) d <- na.omit(bison[seq_len(80), "y.dir", drop = FALSE]) fit <- meanDirectionModel(d, response = "y.dir") fit$natural_parametersdata(bison) d <- na.omit(bison[seq_len(80), "y.dir", drop = FALSE]) fit <- meanDirectionModel(d, response = "y.dir") fit$natural_parameters
Hourly GPS-derived movement metrics for two plains bison (IDs '1044-a' and '1045-a') monitored in Prince Albert National Park (Saskatchewan, Canada) during July-October 2013. From the hourly locations, the dataset includes per-animal direction of movement, step length (distance between consecutive fixes), latitude/longitude, the inter-animal distance at each hour, and turning-angles (difference between consecutive movement directions).
multiplebisonmultiplebison
A data frame with rows (hours kept after filtering) and the
following columns (direction and turning-angle variables are in degrees):
POSIXct. Timestamp of the retained hourly record.
integer. Hour of day (0-23).
numeric. Bearing from bison 1044-a to 1045-a.
numeric. Source variable retained from the merged GPS-derived data.
numeric. Movement direction of bison 1044-a, in degrees.
numeric. Movement direction of bison 1045-a, in degrees.
numeric. Step length (m) of bison 1044-a between consecutive fixes.
numeric. Step length (m) of bison 1045-a between consecutive fixes.
numeric. Inter-animal distance (m) at the timestamp.
numeric. Latitude of bison 1044-a (decimal degrees).
numeric. Latitude of bison 1045-a (decimal degrees).
numeric. Longitude of bison 1044-a (decimal degrees).
numeric. Longitude of bison 1045-a (decimal degrees).
numeric. Turning angle of bison 1044-a between consecutive directions, in degrees.
numeric. Turning angle of bison 1045-a between consecutive directions, in degrees.
The file results from merging individual hourly GPS tracks (one per animal), retaining rows where the time gap between successive fixes is exactly one hour, and reshaping to a "wide" format with one row per timestamp holding both animals' variables. Turning-angles are computed from consecutive directions.
- Angles are measured around the circle and stored in degrees in this package
dataset. Convert to radians before modeling, for example with
x * pi / 180.
- Step lengths and distances were computed from consecutive GPS fixes; rows
are kept only when the time difference equals one hour.
- The turning-angle columns are circular differences between consecutive
movement directions, stored in degrees on a 0-360 scale.
- Scientific provenance is partially documented in the repository. The
maintainer identifies these GPS tracks as associated with doctoral work
and/or an article on bison movement. A closely related scientific article
is Nicosia et al. (2017), which analyzes GPS-collared bison movement in
Prince Albert National Park using an individual winter trajectory from
November 2013 to April 2014. The repository does not verify whether the
current two-bison July-October 2013 data file is a direct subset or
preprocessing product of that analysis.
- The repository does not include raw GPS files or a full reconstruction
script for this processed dataset. The package maintainer has confirmed
that this processed package dataset may be redistributed with the package.
Derived package dataset prepared from GPS tracks of two plains bison monitored in Prince Albert National Park in 2013. The repository does not include raw GPS files or a reconstruction script. The package maintainer has confirmed that this processed package dataset may be redistributed with the package. Nicosia et al. (2017) is a related bison movement article from the same study context, but the exact mapping from that article to this processed data file is not verified in the repository.
Nicosia, A., Duchesne, T., Rivest, L.-P., and Fortin, D. (2017). A multi-state conditional logistic regression model for the analysis of animal movement. The Annals of Applied Statistics, 11(3), 1537-1560. DOI: doi:10.1214/17-AOAS1045.
## Basic glimpse head(multiplebison) ## Example: inter-animal proximity rate (< 500 m) # mean(multiplebison$distance < 500, na.rm = TRUE)## Basic glimpse head(multiplebison) ## Example: inter-animal proximity rate (< 500 m) # mean(multiplebison$distance < 500, na.rm = TRUE)
This data frame contains two circular variables for 678 locations associated
with the Noshiro earthquake. The variables are DIRDSC, the direction
of steepest descent, and DIRMV, the direction of movement.
data(noshiro)data(noshiro)
A data frame with 678 rows and 2 columns:
Direction of steepest descent.
Direction of movement.
The data were used by Rivest (1997) for circular-circular regression. The
processed version included in this package was provided by Louis-Paul Rivest
to the package maintainer after duplicate observations had been removed,
yielding . In the original analysis, DIRMV is the
response variable to be predicted from DIRDSC.
The angular units are not documented in the repository or in the provenance notes provided to the maintainer. Raw data and a reconstruction script are not present in the repository. The package maintainer has confirmed that this processed package dataset may be redistributed with the package.
Processed Noshiro earthquake data used in Rivest (1997), provided by
Louis-Paul Rivest to the package maintainer. Duplicate observations were
removed before inclusion in this package, yielding .
The package maintainer has confirmed that this processed package dataset
may be redistributed with the package.
Rivest, L.-P. (1997). A decentered predictor for circular-circular regression. Biometrika, 84, 717–726.
Backward-compatible wrapper for reference-angle selection
pick_reference_angle(formula, data, tie_method = c("first", "random"), ...)pick_reference_angle(formula, data, tie_method = c("first", "random"), ...)
formula |
Model formula with terms |
data |
Data frame containing model variables. |
tie_method |
Tie-break rule for equal scores. |
... |
Unused. |
A select_reference_angle object, with legacy class
pick_reference_angle prepended.
Draws one arrow per cluster pointing in the direction of the estimated
random intercept . Arrow length is either A1(kappa_a) or 1.
If the 'circular' package is available, uses it for nicer axes; otherwise
falls back to base polar plotting.
plot_ranef.angular_re( x, scale = c("A1_kappa_a", "unit"), labels = FALSE, cex.labels = 0.7, main = "Random intercepts (a_hat[i])", ... )plot_ranef.angular_re( x, scale = c("A1_kappa_a", "unit"), labels = FALSE, cex.labels = 0.7, main = "Random intercepts (a_hat[i])", ... )
x |
an object of class |
scale |
character, one of |
labels |
logical; draw cluster labels at arrow tips. |
cex.labels |
numeric expansion for labels. |
main |
plot title. |
... |
unused |
Draws rose/circular plots of residuals: fixed (y - mu) and conditional (y - mu - a_hat[cluster]) as in Rivest & Kato (2019), Fig. 1-2. If the 'circular' package is available, uses it; otherwise falls back to a simple polar scatter with density ticks.
## S3 method for class 'angular_re' plot( x, which = c("both", "fixed", "conditional"), breaks = 24, points = TRUE, main = "Residuals", ... )## S3 method for class 'angular_re' plot( x, which = c("both", "fixed", "conditional"), breaks = 24, points = TRUE, main = "Residuals", ... )
x |
an object of class |
which |
one of "both", "fixed", "conditional" |
breaks |
number of bins for rose histogram when using circular |
points |
logical; add individual points on the circle |
main |
base title (panel-specific suffixes are added) |
... |
unused |
Predict method for angular_re objects
## S3 method for class 'angular_re' predict( object, newdata = NULL, cluster = NULL, type = c("auto", "marginal", "conditional"), a_hat = NULL, se.fit = FALSE, ... )## S3 method for class 'angular_re' predict( object, newdata = NULL, cluster = NULL, type = c("auto", "marginal", "conditional"), a_hat = NULL, se.fit = FALSE, ... )
object |
an |
newdata |
data.frame; if NULL, uses model frame from the original call. |
cluster |
optional vector/factor of cluster IDs for newdata. |
type |
One of |
a_hat |
optional numeric vector of random-intercept predictions to use
for |
se.fit |
not implemented (reserved). |
... |
unused |
numeric vector (angles in radians).
Fits the Presnell special case by building the linear and orthogonal synthetic terms required by the homogeneous angular formulation. The returned natural parameters are ratios computed from the homogeneous coefficients.
presnellModel(data, response, w, ...)presnellModel(data, response, w, ...)
data |
A data frame containing |
response |
Name of the angular response variable. |
w |
Name of the continuous covariate. |
... |
Additional arguments passed to |
A list with consensus_fit, homogeneous_fit,
reference, data_aug, formula, and natural-parameter
outputs natural_parameters, natural_vcov_model,
natural_vcov_robust, natural_jacobian.
Rivest, L.-P., Duchesne, T., Nicosia, A., and Fortin, D. (2016). A general angular regression model for the analysis of data on animal movement in ecology. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65(3), 445-463.
data(bison) d <- na.omit(bison[500:579, c("y.dir", "z.gap")]) fit <- presnellModel(d, response = "y.dir", w = "z.gap") fit$natural_parametersdata(bison) d <- na.omit(bison[500:579, c("y.dir", "z.gap")]) fit <- presnellModel(d, response = "y.dir", w = "z.gap") fit$natural_parameters
Methods for Angular Regression Objects
## S3 method for class 'angular' print(x, ...) ## S3 method for class 'angular' coef(object, ...) ## S3 method for class 'angular' vcov(object, robust = FALSE, ...) ## S3 method for class 'angular' fitted(object, ...) ## S3 method for class 'angular' residuals(object, ...) ## S3 method for class 'angular' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'angular' summary(object, ...) ## S3 method for class 'summary.angular' print(x, ...) ## S3 method for class 'angular' plot(x, ...)## S3 method for class 'angular' print(x, ...) ## S3 method for class 'angular' coef(object, ...) ## S3 method for class 'angular' vcov(object, robust = FALSE, ...) ## S3 method for class 'angular' fitted(object, ...) ## S3 method for class 'angular' residuals(object, ...) ## S3 method for class 'angular' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'angular' summary(object, ...) ## S3 method for class 'summary.angular' print(x, ...) ## S3 method for class 'angular' plot(x, ...)
x |
An object of class |
... |
Additional arguments. |
object |
An object of class |
robust |
Logical; for |
newdata |
Optional data frame for prediction. |
type |
Prediction type. Use |
Methods for Angular Random-Effects Fits
## S3 method for class 'angular_re' print(x, ...) ## S3 method for class 'angular_re' summary(object, ...) ## S3 method for class 'summary.angular_re' print(x, ...) ## S3 method for class 'angular_re' coef(object, ...) ## S3 method for class 'angular_re' vcov(object, robust = FALSE, ...) ## S3 method for class 'angular_re' residuals(object, type = c("fixed", "conditional"), ...) ## S3 method for class 'angular_re' fitted(object, ...)## S3 method for class 'angular_re' print(x, ...) ## S3 method for class 'angular_re' summary(object, ...) ## S3 method for class 'summary.angular_re' print(x, ...) ## S3 method for class 'angular_re' coef(object, ...) ## S3 method for class 'angular_re' vcov(object, robust = FALSE, ...) ## S3 method for class 'angular_re' residuals(object, type = c("fixed", "conditional"), ...) ## S3 method for class 'angular_re' fitted(object, ...)
x, object
|
An object of class |
... |
Additional arguments, currently unused. |
robust |
Logical. For |
type |
Residual type. |
coef() returns the parameter estimates. vcov() returns
the requested covariance matrix. fitted() returns marginal fitted
mean directions. residuals() returns wrapped circular residuals.
summary() returns a list with convergence information, likelihood,
sample sizes, concentration estimates, residual summaries and coefficient
table. print() invisibly returns the input object.
Methods for two-step angular regression objects
## S3 method for class 'angular_two_step' print(x, ...) ## S3 method for class 'angular_two_step' summary(object, ...) ## S3 method for class 'summary.angular_two_step' print(x, ...) ## S3 method for class 'angular_two_step' coef(object, step = c("homogeneous", "consensus"), ...) ## S3 method for class 'angular_two_step' fitted(object, ...) ## S3 method for class 'angular_two_step' residuals(object, ...) ## S3 method for class 'angular_two_step' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'angular_two_step' plot(x, ...) ## S3 method for class 'angular_two_step' logLik(object, ...) ## S3 method for class 'angular_two_step' AIC(object, ..., k = 2) ## S3 method for class 'angular_two_step' BIC(object, ...)## S3 method for class 'angular_two_step' print(x, ...) ## S3 method for class 'angular_two_step' summary(object, ...) ## S3 method for class 'summary.angular_two_step' print(x, ...) ## S3 method for class 'angular_two_step' coef(object, step = c("homogeneous", "consensus"), ...) ## S3 method for class 'angular_two_step' fitted(object, ...) ## S3 method for class 'angular_two_step' residuals(object, ...) ## S3 method for class 'angular_two_step' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'angular_two_step' plot(x, ...) ## S3 method for class 'angular_two_step' logLik(object, ...) ## S3 method for class 'angular_two_step' AIC(object, ..., k = 2) ## S3 method for class 'angular_two_step' BIC(object, ...)
x, object
|
An object of class |
... |
Additional arguments passed to the underlying method. |
step |
Which fitted step to use for |
newdata |
Optional data frame for prediction. |
type |
Prediction type passed to |
k |
Numeric penalty used by |
Methods for Circular Regression Objects
## S3 method for class 'circular_regression' print(x, ...) ## S3 method for class 'circular_regression' summary(object, ...) ## S3 method for class 'summary.circular_regression' print(x, ...) ## S3 method for class 'circular_regression' coef(object, ...) ## S3 method for class 'circular_regression' fitted(object, ...) ## S3 method for class 'circular_regression' residuals(object, ...) ## S3 method for class 'circular_regression' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'circular_regression' plot(x, ...) ## S3 method for class 'circular_regression' logLik(object, ...) ## S3 method for class 'circular_regression' AIC(object, ..., k = 2) ## S3 method for class 'circular_regression' BIC(object, ...)## S3 method for class 'circular_regression' print(x, ...) ## S3 method for class 'circular_regression' summary(object, ...) ## S3 method for class 'summary.circular_regression' print(x, ...) ## S3 method for class 'circular_regression' coef(object, ...) ## S3 method for class 'circular_regression' fitted(object, ...) ## S3 method for class 'circular_regression' residuals(object, ...) ## S3 method for class 'circular_regression' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'circular_regression' plot(x, ...) ## S3 method for class 'circular_regression' logLik(object, ...) ## S3 method for class 'circular_regression' AIC(object, ..., k = 2) ## S3 method for class 'circular_regression' BIC(object, ...)
x, object
|
A |
... |
Additional arguments passed to the underlying method. |
newdata |
Optional data frame for prediction. |
type |
Prediction type passed to the underlying model. |
k |
Numeric penalty used by |
Methods for Consensus Objects
## S3 method for class 'consensus' print(x, ...) ## S3 method for class 'consensus' coef( object, type = c("kappa", "beta"), reference = c("auto", "first", "name"), ... ) ## S3 method for class 'consensus' vcov(object, robust = FALSE, ...) ## S3 method for class 'consensus' fitted(object, ...) ## S3 method for class 'consensus' residuals(object, ...) ## S3 method for class 'consensus' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'consensus' summary(object, ...) ## S3 method for class 'summary.consensus' print(x, ...) ## S3 method for class 'consensus' plot(x, ...) ## S3 method for class 'consensus' AIC(object, ..., k = 2) ## S3 method for class 'consensus' BIC(object, ...) ## S3 method for class 'consensus' logLik(object, ...)## S3 method for class 'consensus' print(x, ...) ## S3 method for class 'consensus' coef( object, type = c("kappa", "beta"), reference = c("auto", "first", "name"), ... ) ## S3 method for class 'consensus' vcov(object, robust = FALSE, ...) ## S3 method for class 'consensus' fitted(object, ...) ## S3 method for class 'consensus' residuals(object, ...) ## S3 method for class 'consensus' predict(object, newdata = NULL, type = c("response", "components"), ...) ## S3 method for class 'consensus' summary(object, ...) ## S3 method for class 'summary.consensus' print(x, ...) ## S3 method for class 'consensus' plot(x, ...) ## S3 method for class 'consensus' AIC(object, ..., k = 2) ## S3 method for class 'consensus' BIC(object, ...) ## S3 method for class 'consensus' logLik(object, ...)
x |
An object of class |
... |
Additional arguments. |
object |
An object of class |
type |
For |
reference |
Reference selection rule for |
robust |
Logical; for |
newdata |
Optional data frame for prediction. |
k |
Numeric penalty for AIC. |
pick_reference_angle
Print method for pick_reference_angle
## S3 method for class 'pick_reference_angle' print(x, ...)## S3 method for class 'pick_reference_angle' print(x, ...)
x |
Object returned by |
... |
Unused. |
Returns the cluster-specific random intercepts estimated by
angular_re().
ranef.angular_re(object, ...)ranef.angular_re(object, ...)
object |
A fitted |
... |
Unused; included for compatibility with the generic. |
A named numeric vector of random intercept estimates, one per cluster.
This dataset contains repeated measurements on the escape orientation of 59 sandhoppers (Talitrus saltator) in a circular arena experiment with a diameter of 120 cm. Each individual was released five times, and its escape angle with respect to the north was recorded. Several explanatory variables were also measured during the experiment.
data(Sandhopper)data(Sandhopper)
A data frame with 72 rows and 22 variables:
Individual identifier (integer).
Day of the experiment.
Part of the day (character, e.g., "mor", "aft").
Sun azimuth at release (degrees).
Escape orientation, trial 1 (degrees).
Escape orientation, trial 2 (degrees).
Escape orientation, trial 3 (degrees).
Escape orientation, trial 4 (degrees).
Escape orientation, trial 5 (degrees).
Relative humidity (%).
Air temperature (degrees Celsius).
Sand temperature (degrees Celsius).
Wind direction (degrees).
Wind speed (arbitrary units).
Sex of the sandhopper ("f" or "m").
Weight of the sandhopper (grams).
Morphometric measurement.
Morphometric measurement.
Morphometric measurement.
Morphometric measurement.
Morphometric measurement.
Morphometric measurement.
The dataset was originally presented and analyzed by D'Elia (2001) and later used in Rivest & Kato (2019) to illustrate angular regression models with repeated measures.
Angular variables such as Azimuth, LN1-LN5 and
DirW are stored in degrees. The repository does not include a full
raw-data reconstruction script for this processed dataset. The package
maintainer has confirmed that this processed package dataset may be
redistributed with the package.
Package data file corresponding to the sandhopper example discussed by D'Elia (2001) and Rivest and Kato (2019). The repository does not include a raw-data reconstruction script.
D'Elia, G. (2001). Orientation in sandhoppers. *Behavioural Ecology*. Rivest, L.-P., & Kato, S. (2019). A random-effects model for clustered circular data. *Canadian Journal of Statistics*, 47(4), 712-728.
Selects the reference direction using the criterion of Rivest et al. (2016):
the angle variable maximizing the empirical mean cosine
among plain angle terms x present in the
formula.
select_reference_angle( formula, data, tie_method = c("first", "random"), na.action = stats::na.omit )select_reference_angle( formula, data, tie_method = c("first", "random"), na.action = stats::na.omit )
formula |
Model formula containing terms of the form |
data |
Data frame used to evaluate the formula. |
tie_method |
Tie-break rule when multiple candidates share the same
score: |
na.action |
Function used by |
An object of class "select_reference_angle".