CausalMixGPD
  • Home
  • Roadmaps
    • Website roadmap
    • Package roadmap
  • Start
    • Start Hub
    • Roadmap
    • Usage Diagrams
    • Start Here
    • Basic Compile and Run
    • Backends and Workflow
    • Troubleshooting
  • Tracks
    • Quickstart
    • Modeling (1-arm)
    • Causal
    • Clustering
    • Kernels & tails
    • Customization
  • Examples
  • Kernels
  • Advanced
  • Developers
  • Reference
    • Reference hub
    • Function reference by job
  • News
  • Cite
  • Coverage
  • API Reference

Cauchy

Cauchy

Cauchy base and mixtures

A Cauchy distribution with location (x_0) and scale (>0) has density [ f(yx_0,)=, y. ]

A finite Cauchy mixture is [ f(y)={j=1}^J w_j,(yx{0j},_j). ]

Parameter mapping (math () code): (x_0) location, () scale; in mixtures (x_{0j}) location[j], (_j) scale[j], (w_j) w[j].

Without GPD (base and mixture)

Code
grid <- seq(-8, 8, length.out = 400)
cauchy_sets <- list(
  list(label = "Base", location = 0, scale = 1),
  list(label = "Mix A", w = c(0.6, 0.3, 0.1), location = c(-1, 0, 1), scale = c(1.0, 1.2, 2)),
  list(label = "Mix B", w = c(0.5, 0.3, 0.2), location = c(-1.5, 0.5, 1.5), scale = c(1.1, 1.0, 0.9))
)

base_par <- cauchy_sets[[1]]
mix_par1 <- cauchy_sets[[2]]
Code
dCauchy(0, location = base_par$location, scale = base_par$scale)
[1] 0.3183099
Code
dCauchy(0, location = base_par$location, scale = base_par$scale, log = TRUE)
[1] -1.14473
Code
pCauchy(0, location = base_par$location, scale = base_par$scale)
[1] 0.5
Code
pCauchy(0, location = base_par$location, scale = base_par$scale, lower.tail = FALSE)
[1] 0.5
Code
pCauchy(0, location = base_par$location, scale = base_par$scale, log.p = TRUE)
[1] -0.6931472
Code
q_vec(qCauchy, c(0.25, 0.5, 0.75), location = base_par$location,
      scale = base_par$scale)
[1] -1  0  1
Code
q_vec(qCauchy, c(0.25, 0.5, 0.75), location = base_par$location,
      scale = base_par$scale, lower.tail = FALSE)
[1]  1  0 -1
Code
q_vec(qCauchy, c(log(0.25), log(0.5), log(0.75)), location = base_par$location,
      scale = base_par$scale, log.p = TRUE)
[1] -1  0  1
Code
draw_many(rCauchy, list(location = base_par$location, scale = base_par$scale))
[1] -0.9070131 -0.4248394  0.2329576  3.3710605 -1.3611982
Code
dCauchyMix(0, w = mix_par1$w, location = mix_par1$location, scale = mix_par1$scale)
[1] 0.1878028
Code
dCauchyMix(0, w = mix_par1$w, location = mix_par1$location, scale = mix_par1$scale, log = TRUE)
[1] -1.672363
Code
draw_many(rCauchyMix, list(w = mix_par1$w, location = mix_par1$location, scale = mix_par1$scale))
[1]  6.8345157  0.5153257 -2.3234165 -0.3339875  0.1331388
Code
df_cauchy <- rbind(
  data.frame(x = grid, density = density_curve(grid, dCauchy, list(location = base_par$location, scale = base_par$scale)), label = "Base"),
  data.frame(x = grid, density = density_curve(grid, dCauchyMix, list(w = mix_par1$w, location = mix_par1$location, scale = mix_par1$scale)), label = "Mix A"),
  data.frame(x = grid, density = density_curve(grid, dCauchyMix, list(w = cauchy_sets[[3]]$w, location = cauchy_sets[[3]]$location, scale = cauchy_sets[[3]]$scale)), label = "Mix B")
)

ggplot(df_cauchy, aes(x = x, y = density, color = label)) +
  geom_line(linewidth = 1) +
  labs(title = "Cauchy base and mixtures", x = "x", y = "density") +
  theme_minimal() + theme(legend.position = "top")

Prereqs

  • Required packages and data for this page are listed in the setup chunks above.

Outputs

  • This page renders model fits, diagnostics, and summary artifacts generated by package APIs.

Interpretation

  • Canonical concept page: Introduction With Gpd Kernel
  • Treat this page as an application/example view and use the canonical page for core definitions.

Next

  • Continue to the linked canonical concept page, then return for implementation-specific details.
(c) CausalMixGPD - Bayesian semiparametric modeling for heavy-tailed data
- - Cite - API - GitHub