joint: Density, Distribution, Quantiles and Random Number Generation...

jointR Documentation

Density, Distribution, Quantiles and Random Number Generation for joint distributions

Description

The bivariate joint distributions are described in terms of two marginal distributions and a copula

Usage

rjoint(n, copula, marginal_1, marginal_2)

djoint(x, copula, marginal_1, marginal_2)

pjoint(q, copula, marginal_1, marginal_2)

Arguments

n

integer value, the number of random samples to be generated with rjoint().

copula

R object of class 'cyl_copula'. or 'Copula' (package 'copula', only 2-dimensional).

marginal_1

named list (for parametric estimates) or a 'density' object (for linear kernel density estimates) or a 'density.circular' object (for circular kernel density estimates). The output of functions fit_angle() and fit_steplength() can be used here directly.

marginal_2

This input is similar to marginal_1.

x

matrix (or vector) of numeric values giving the points (in 2 dimensions) where the density function is evaluated.

q

matrix (or vector) of numeric values giving the points (in 2 dimensions) where the distribution function is evaluated.

Details

If entered "by hand", the named lists describing the parametric distributions (marginal_1 and marginal_2) must contain 2 entries:

  1. name: a character string denoting the name of the distribution. For a circular distribution, it can be "vonmises", "vonmisesmix", or "wrappedcauchy". For a linear distribution, it must be a string denoting the name of a linear distribution in the environment, i.e. the name of its distribution function without the "p", e.g. "norm" for normal distribution

  2. coef: For a circular distribution coef is a (named) list of parameters of the circular marginal distribution as taken by the functions qvonmises(), qvonmisesmix(), or qwrappedcauchy(). For a linear distribution, coef is a named list containing the parameters of the distribution given in "name".

Value

  • djoint() gives a vector of length length(x) containing the density at x.

  • pjoint() gives a vector of length length(q) containing the distribution function at the corresponding values of q.

  • rjoint() generates a vector of length n containing the random samples.

Examples

cop <- copula::normalCopula(0.6)
marginal_1 <- list(name="exp",coef=list(rate=2))
marginal_2 <- list(name="lnorm", coef=list(0,0.1))

sample <- rjoint(10,cop,marginal_1,marginal_2)
pjoint(sample,cop,marginal_1,marginal_2)
djoint(sample,cop,marginal_1,marginal_2)

cop <- cyl_quadsec()
marginal_1 <- list(name="wrappedcauchy", coef=list(location=0,scale=0.3))
marginal_2 <- list(name="weibull",coef=list(shape=3))

sample <- rjoint(10,cop,marginal_1,marginal_2)
marginal_1 <- fit_angle(theta=sample[,1], parametric=FALSE)
marginal_2 <- fit_steplength(x=sample[,2],parametric="lnorm")
pjoint(c(0.3*pi,4),cop,marginal_1,marginal_2)
djoint(c(0,2),cop,marginal_1,marginal_2)


cylcop documentation built on Oct. 30, 2022, 1:05 a.m.