set.seed(123)
cop <- cyl_quadsec(0.1)
marg1 <- list(name="vonmises",coef=list(0,4))
marg2 <- list(name="lnorm",coef=list(2,3))
#draw samples and calculate the mutual information.
sample <- rjoint(100,cop,marg1,marg2)
mi_cyl(theta = sample[,1],
x = sample[,2],
normalize = TRUE,
symmetrize = FALSE
)
#the correlation coefficient is independent of the marginal distribution.
sample <- traj_sim(100,
cop,
marginal_circ = list(name = "vonmises", coef = list(0, 1)),
marginal_lin = list(name = "weibull", coef = list(shape = 2))
)
mi_cyl(theta = sample$angle,
x = sample$steplength,
normalize = TRUE,
symmetrize = FALSE)
mi_cyl(theta = sample$cop_u,
x = sample$cop_v,
normalize = TRUE,
symmetrize = FALSE)
# Estimate correlation of samples drawn from circular-linear copulas
# with perfect correlation.
cop <- cyl_rect_combine(copula::normalCopula(1))
sample <- rjoint(100,cop,marg1,marg2)
# without normalization
mi_cyl(theta = sample[,1],
x = sample[,2],
normalize = FALSE,
symmetrize = FALSE
)
#with normalization
mi_cyl(theta = sample[,1],
x = sample[,2],
normalize = TRUE,
symmetrize = FALSE
)
#only with normalization and symmetrization do we get a value of 1
mi_cyl(theta = sample[,1],
x = sample[,2],
normalize = TRUE,
symmetrize = TRUE
)
Run the code above in your browser using DataLab