Type: | Package |
Title: | Projected Polya Tree for Circular Data |
Version: | 0.2.3 |
Author: | Karla Mayra Perez [aut, cre], Luis E. Nieto-Barajas [aut] |
Maintainer: | Karla Mayra Perez <karla.mayra25@gmail.com> |
Description: | Provides functionality for the prior and posterior projected Polya tree for the analysis of circular data (Nieto-Barajas and Nunez-Antonio (2019) <doi:10.48550/arXiv.1902.06020>). |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
RoxygenNote: | 7.2.1 |
Imports: | circular, stats, graphics, progress, methods |
URL: | https://github.com/Karlampm/PPTcirc |
BugReports: | https://github.com/Karlampm/PPTcirc/issues |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2022-08-29 21:14:56 UTC; karla |
Repository: | CRAN |
Date/Publication: | 2022-08-30 08:10:16 UTC |
Time of the day when a deer was observed
Description
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.
Usage
data(deer)
Format
A vector of 115 observations (in radians).
References
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
Posterior projected Polya Tree distribution
Description
Performs posterior inference for a given a circular dataset with the Projected Polya Tree via a MCMC algorithm.
Usage
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())
Arguments
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. |
Value
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. |
References
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
See Also
Examples
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))
Prior projected Polya tree distribution
Description
Simulates paths of prior projected Polya tree distributions centered around a projected normal distribution.
Usage
dsimpriorppt(nsim = 5, mm = 4,mu = c(0, 0),
sig = 1, ll = 100, aa = 1, delta = 1.1, units = "radians")
Arguments
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". |
Value
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. |
References
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
See Also
priorppt.plot
, priorppt.summary
Examples
z <- dsimpriorppt(mu = c(5,5), nsim = 5, units = "radians")
priorppt.plot(z, plot.type = "line")
summary(z$stats)
Time of the day when a peccary was observed
Description
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.
Usage
data(peccary)
Format
A vector of 16 observations (in radians).
References
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf
Plot method for posterior projected Polya tree
Description
Plots posterior projected Polya tree estimates.
Usage
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,sep = 0.025, ylim = NULL, xlim = NULL, breaks = 12)
Arguments
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. |
breaks |
one of: a vector giving the breakpoints between histogram cells, a function to compute the vector of breakpoints, a single number giving the number of cells for the histogram, a character string naming an algorithm to compute the number of cells, a function to compute the number of cells. |
See Also
Examples
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)
Summary statistics for the post projected Polya tree
Description
Extracts mean, quantiles 2.5% and 97.5% of the mean direction and concentration.
Usage
postppt.summary(postppt.circ)
Arguments
postppt.circ |
object returned by |
Value
table of descriptive statistics.
Examples
z1 <- dsimpostppt(tapir, units = "radians", it = 5, ti =1, bi=0)
postppt.summary(z1)
Plot method for prior projected Polya tree
Description
Plots density paths of simulated prior projected Polya tree, mean direction and concentration.
Usage
priorppt.plot(priorppt.circ, n.path="all",
plot.type = c("circle", "line", "summary"),control.circular = list(),
shrink=1, tol = 0.04,ylim)
Arguments
priorppt.circ |
object returned by |
n.path |
"all" plots all the simulated paths or numeric parameter 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. |
Value
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"
See Also
Examples
z <- dsimpriorppt(mu = c(0,1), nsim = 5, units = "degrees")
priorppt.plot(z, plot.type = "circle",shrink =0.5, tol = 4)
priorppt.plot(z, plot.type = "line")
priorppt.plot(z, plot.type = "summary")
Summary for the prior projected Polya tree simulations
Description
Mean, quantiles 2.5% and 97.5% of the mean direction and concentration.
Usage
priorppt.summary(priorppt.circ, units = "radians")
Arguments
priorppt.circ |
object returned by |
units |
units of the support: "radians", "degrees" or "hours". |
Value
Table of descriptive statistics for mean direction and concentration.
Examples
z <- dsimpriorppt(mu = c(-1,0), nsim = 5, units = "hours")
priorppt.summary(z)
Time of the day when a tapir was observed
Description
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.
Usage
data(tapir)
Format
A vector of 35 observations (in radians).
References
Nieto-Barajas, L.E. & Nunez-Antonio, G. (2019). Projected Polya tree. https://arxiv.org/pdf/1902.06020.pdf