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)
Run the code above in your browser using DataLab