Title: | Projected Polya Tree for Circular Data |
---|---|
Description: | Provides functionality for the prior and posterior projected Polya tree for the analysis of circular data (Nieto-Barajas and Nunez-Antonio (2019) <arXiv:1902.06020>). |
Authors: | Karla Mayra Perez [aut, cre], Luis E. Nieto-Barajas [aut] |
Maintainer: | Karla Mayra Perez <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2025-02-21 02:58:42 UTC |
Source: | https://github.com/karlampm/pptcirc |
Temporal activity information (time of the day in radians) when a camera detected the appearance of a deer at El Triunfo biosphere in Mexico in 2015 data provided by Eduardo Mendoza from Universidad Michoacana de San Nicolas de Hidalgo, Mexico.
data(deer)
data(deer)
A vector of 115 observations (in radians).
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
Performs posterior inference for a given a circular dataset with the Projected Polya Tree via a MCMC algorithm.
dsimpostppt(datafile,units = c("radians", "degrees", "hours"), mm = 4, mu = c(0, 0), sig = 1, aa = 1, delta = 1.1, it = 500, bi = 50, ti = 2, kapa = 0.5, ha = 0, hm = 0, c0 = 1, c1 = 2, iota = 6, mu0 = 0, taum = 1, control.circular = list())
dsimpostppt(datafile,units = c("radians", "degrees", "hours"), mm = 4, mu = c(0, 0), sig = 1, aa = 1, delta = 1.1, it = 500, bi = 50, ti = 2, kapa = 0.5, ha = 0, hm = 0, c0 = 1, c1 = 2, iota = 6, mu0 = 0, taum = 1, control.circular = list())
datafile |
the data from which the estimate is to be computed. The object is circular or will be coerced to circular. |
units |
units of the support: "radians", "degrees" or "hours". |
mm |
number of finite levels of the Polya tree |
mu |
mean vector of the projected bivariate normal centering distribution. |
sig |
precision of the projected bivariate normal centering distribution. |
aa |
alpha. Standard deviation parameter of the projected Polya tree. |
delta |
controls of the speed at which the variances of the branching probabilities move down in the tree, rho(m)=m^delta. |
it |
number of iterations for MCMC. |
bi |
number of burn in iterations for MCMC. |
ti |
thinning parameter of the MCMC chain. |
kapa |
tunning parameter in the MH proposal distribution for the latent resultants R. |
ha |
logical. If TRUE alpha will be assigned Ga(c0,c1) hyper-prior distribution. |
hm |
logical. If TRUE mu will be assigned N(mu0,taum) independent hyper-prior distributions for each coordinate. |
c0 , c1
|
shape and rate hyper-parameters of the gamma prior distribution for alpha. These will be used only when ha=1. |
iota |
tunning parameter in the MH proposal distribution for alpha. |
mu0 , taum
|
mean and precision hyper-parameters of the independent normal prior distribution for each coordinate of mu. These will be used only when hm=1. |
control.circular |
the attribute used to coerced the resulting. object. See circular. |
An object of class postppt.circ whose underlying structure is a list containing the following components:
x |
points where the density is evaluated. |
predictive |
predicitive density estimated with the projected Polya tree. |
quantile2.5 quantile97.5 |
lower and upper 95% credible interval limits. |
stats |
descriptive statistics: mean direction and concentration of each MCMC density. |
cpo |
conditional predictive ordinate statistic for the data. |
LMPL |
logarithm of the pseudo marginal likelihood statistic. |
aa.sims |
vector of simulated alphas when ha=1. |
mu.sims |
matrix of simulated bivariate means when hm=1. |
acceptancerate |
Acceptance rate of MH step for the latent resultants. |
acceptancerate_aa |
Acceptance rate of MH step for alpha. |
data |
original dataset. |
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
data(tapir) #It is advised to increase the number of iterations for a better fitting z1 <- dsimpostppt(tapir, units = "radians", it = 5, ti =1, bi=0, ha = 1, hm =1) class(z1) length(z1$acceptancerate) z1$acceptancerate postppt.summary(z1) postppt.plot(z1, plot.type= "line" , ylim = c(0,0.8))
data(tapir) #It is advised to increase the number of iterations for a better fitting z1 <- dsimpostppt(tapir, units = "radians", it = 5, ti =1, bi=0, ha = 1, hm =1) class(z1) length(z1$acceptancerate) z1$acceptancerate postppt.summary(z1) postppt.plot(z1, plot.type= "line" , ylim = c(0,0.8))
Simulates paths of prior projected Polya tree distributions centered around a projected normal distribution.
dsimpriorppt(nsim = 5, mm = 4,mu = c(0, 0), sig = 1, ll = 100, aa = 1, delta = 1.1, units = "radians")
dsimpriorppt(nsim = 5, mm = 4,mu = c(0, 0), sig = 1, ll = 100, aa = 1, delta = 1.1, units = "radians")
nsim |
integer indicating the number of simulations. |
mm |
integer indicating the number of finite levels of the Polya tree. |
mu |
mean vector of the projected bivariate normal distribution. |
sig |
standard deviation of the projected bivariate normal distribution. We advise to always use sig = 1. |
ll |
number of equally spaced points at which the projected distribution will be evaluated. |
aa |
alpha. Precision parameter of the Polya tree. |
delta |
controls of the speed at which the variances of the branching probabilities move down in the tree, rho(m)=m^delta. |
units |
units of the support: "radians", "degrees" or "hours". |
An object with class priorppt.circ whose underlying structure is a list containing the following components:
x |
points where the density is evaluated. |
ppt.sims |
simulated density paths of the prior projected Polya tree. |
stats |
descriptive statistics: mean direction and concentration of each simulated density. |
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
priorppt.plot
, priorppt.summary
z <- dsimpriorppt(mu = c(5,5), nsim = 5, units = "radians") priorppt.plot(z, plot.type = "line") summary(z$stats)
z <- dsimpriorppt(mu = c(5,5), nsim = 5, units = "radians") priorppt.plot(z, plot.type = "line") summary(z$stats)
Temporal activity information (time of the day in radians) when a camera detected the appearance of a peccary at El Triunfo biosphere in Mexico in 2015 data provided by Eduardo Mendoza from Universidad Michoacana de San Nicolas de Hidalgo, Mexico.
data(peccary)
data(peccary)
A vector of 16 observations (in radians).
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
Plots posterior projected Polya tree estimates.
postppt.plot(postppt.circ, plot.type = c("circle", "line", "summary", "a.sim", "mu.sim", "cpos"), interval = TRUE, control.circular = list(), shrink = 1, tol = 0.04, ylim = NULL)
postppt.plot(postppt.circ, plot.type = c("circle", "line", "summary", "a.sim", "mu.sim", "cpos"), interval = TRUE, control.circular = list(), shrink = 1, tol = 0.04, ylim = NULL)
postppt.circ |
object returned by the |
plot.type |
type of plot to be drawn: "circle" for circular plot, "line" for linear plot, "summary" for boxplot of mean direction and concentration, "cpos" for cpos scatter plot "a.sim" for summary plots of simulated alphas and "mu.sim" for summary plots of simulated mu1 and mu2. |
interval |
logical. If TRUE 95% credible intervals will be shown in the circular and linear plots. |
control.circular |
attributes of circular object in order to draw the circle.See |
shrink |
parameter that controls the size of the plotted circle. Default is 1. Larger values shrink the circle, while smaller values enlarge the circle. |
tol |
proportion of white space at the margins of plot. |
sep |
constant used to specify the distance between stacked points. Default is 0.025;smaller values will create smaller spaces |
ylim |
range to be encompassed by "y" axis. |
xlim |
range to be encompassed by "x" axis. |
z2 <- dsimpostppt(deer, units = "radians", it = 10, ti =1, bi=0, ha = 1) postppt.plot(z2, plot.type= "line" , shrink = 1.4, tol = 1.2, ylim = c(0,0.6)) postppt.summary(z2) postppt.plot(z2, plot.type= "cpos" ) postppt.plot(z2, plot.type= "circle" , shrink = 1.4, tol = 1.2)
z2 <- dsimpostppt(deer, units = "radians", it = 10, ti =1, bi=0, ha = 1) postppt.plot(z2, plot.type= "line" , shrink = 1.4, tol = 1.2, ylim = c(0,0.6)) postppt.summary(z2) postppt.plot(z2, plot.type= "cpos" ) postppt.plot(z2, plot.type= "circle" , shrink = 1.4, tol = 1.2)
Extracts mean, quantiles 2.5% and 97.5% of the mean direction and concentration.
postppt.summary(postppt.circ)
postppt.summary(postppt.circ)
postppt.circ |
object returned by |
table of descriptive statistics.
z1 <- dsimpostppt(tapir, units = "radians", it = 5, ti =1, bi=0) postppt.summary(z1)
z1 <- dsimpostppt(tapir, units = "radians", it = 5, ti =1, bi=0) postppt.summary(z1)
Plots density paths of simulated prior projected Polya tree, mean direction and concentration.
priorppt.plot(priorppt.circ, n.path="all", plot.type = c("circle", "line", "summary"),control.circular = list(), shrink=1, tol = 0.04,ylim)
priorppt.plot(priorppt.circ, n.path="all", plot.type = c("circle", "line", "summary"),control.circular = list(), shrink=1, tol = 0.04,ylim)
priorppt.circ |
object returned by |
n.path |
"all" plots all the simulated paths or numeric atomic vector indicates the simulation path of the priorppt.circ object that will be plot. |
plot.type |
type of plot to be drawn: "circle" for circular plot, "line" for linear plot and "summary" for boxplot of mean direction and concentration. |
control.circular |
attributes of circular object in order to draw the circle.See |
shrink |
parameter that controls the size of the plotted circle. Default is 1. Larger values shrink the circle, while smaller values enlarge the circle. |
tol |
proportion of white space at the margins of plot. |
ylim |
range to be encompassed by "y" axis. |
Circular plot of simulated paths when plot.type = "circle". Linear plot of simulated paths for plot.type = "line". Boxplot of mean direction and concentration for plot.type = "summary"
z <- dsimpriorppt(mu = c(0,1), nsim = 5, units = "degrees") priorppt.plot(z, plot.type = "circle",shrink =0.0071, tol = 3.9) priorppt.plot(z, plot.type = "line",shrink =0.0071, tol = 3.9) priorppt.plot(z, plot.type = "summary",shrink =0.0071, tol = 3.9)
z <- dsimpriorppt(mu = c(0,1), nsim = 5, units = "degrees") priorppt.plot(z, plot.type = "circle",shrink =0.0071, tol = 3.9) priorppt.plot(z, plot.type = "line",shrink =0.0071, tol = 3.9) priorppt.plot(z, plot.type = "summary",shrink =0.0071, tol = 3.9)
Mean, quantiles 2.5% and 97.5% of the mean direction and concentration.
priorppt.summary(priorppt.circ, units = "radians")
priorppt.summary(priorppt.circ, units = "radians")
priorppt.circ |
object returned by |
units |
units of the support: "radians", "degrees" or "hours". |
Table of descriptive statistics for mean direction and concentration.
z <- dsimpriorppt(mu = c(-1,0), nsim = 5, units = "hours") priorppt.summary(z)
z <- dsimpriorppt(mu = c(-1,0), nsim = 5, units = "hours") priorppt.summary(z)
Temporal activity information (time of the day in radians) when a camera detected the appearance of a tapir at El Triunfo biosphere in Mexico in 2015 data provided by Eduardo Mendoza from Universidad Michoacana de San Nicolas de Hidalgo, Mexico.
data(tapir)
data(tapir)
A vector of 35 observations (in radians).
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf