fit_angle | R Documentation |
This function finds parameter estimates of the marginal circular distribution (with potentially fixed mean), or gives a kernel density estimate using a von Mises smoothing kernel.
fit_angle( theta, parametric = c("vonmises", "wrappedcauchy", "vonmisesmix", FALSE), bandwidth = NULL, mu = NULL, ncomp = 2 )
theta |
numeric vector of angles in [-π, π). |
parametric |
either a character string describing what distribution
should be fitted ( |
bandwidth |
If |
mu |
(optional) numeric vector, fixed mean direction(s) of the parametric distribution. |
ncomp |
integer, number of components of the mixed von Mises distribution.
Only has an effect if |
If a parametric estimate is made, a list is returned
containing the estimated parameters, their
standard errors (if available), the log-likelihood,
the AIC and the name of the distribution.
If a non-parametric estimate is made, the output is a 'density.circular
' object
obtained with the function circular::density.circular()
of the 'circular'
package.
circular::density.circular()
,
fit_angle()
, opt_circ_bw()
.
set.seed(123) silent_curr <- cylcop_get_option("silent") cylcop_set_option(silent = TRUE) n <- 10 #n (number of samples) is set small for performance. angles <- rvonmisesmix(n, mu = c(0, pi), kappa = c(2,1), prop = c(0.5, 0.5) ) bw <- opt_circ_bw(theta = angles, method="nrd", kappa.est = "trigmoments" ) dens_non_param <- fit_angle(theta = angles, parametric = FALSE, bandwidth = bw ) param_estimate <- fit_angle(theta = angles, parametric = "vonmisesmix" ) param_estimate_fixed_mean <- fit_angle(theta = angles, parametric = "vonmisesmix", mu = c(0, pi), ncomp =2 ) cylcop_set_option(silent = silent_curr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.