From 6ac503848b7478ab5985f16559ad4a67302e1cc7 Mon Sep 17 00:00:00 2001 From: Santymax98 <132070198+Santymax98@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:39:13 -0300 Subject: [PATCH 1/4] Update paper.md add example --- joss/paper.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/joss/paper.md b/joss/paper.md index 6dd598e86..b901f449a 100644 --- a/joss/paper.md +++ b/joss/paper.md @@ -108,6 +108,35 @@ using Turing Turing.Turing.@addlogprob! loglikelihood(D, dataset) end ``` +Outside the common context we can use the API to work on different aspects, suppose you want to generate random samples of a copula whose parameter depends on a covariate $X$ [@abegaz2012], for example, Consider the Frank copula whose parameter depends on a covariate $X$ that follows a truncated normal distribution with mean zero and variance 9. Also, consider the parameter $\theta(x), x \in [-2,2]$. +```julia +using Distributions, Copulas, DataFrames + +x= truncated(Normal(0,3),-2,2) + +function model_1(x) + return (10-1.5x^2) +end + +data = rand(x,10^5) + +#Frank Copula whose parameter depends on a covariate +function rFrank(x, C_function, dimension) + data_list = DataFrame(u1=Float64[], u2=Float64[]) + + for i in x + param = C_function(i) + copula_instance = FrankCopula(dimension, param) + value_copula = rand(copula_instance, 1) + push!(data_list, (value_copula[1], value_copula[2])) + end + + return data_list +end + +New_frank = rFrank(data, model_1, 2) +``` +In this way we easily obtain random samples of a new bivariate Frank copula whose parameter can depend on any covariate. ## The Archimedean interface From c6e0f303713a8d23d22c6ddaa6ca1859361393a0 Mon Sep 17 00:00:00 2001 From: Santymax98 <132070198+Santymax98@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:41:51 -0300 Subject: [PATCH 2/4] Update paper.bib add reference --- joss/paper.bib | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/joss/paper.bib b/joss/paper.bib index 2d1325de5..3323ae07f 100644 --- a/joss/paper.bib +++ b/joss/paper.bib @@ -237,4 +237,14 @@ @Article{BenchmarkTools primaryClass = {cs.PF}, adsurl = {https://ui.adsabs.harvard.edu/abs/2016arXiv160804295C}, adsnote = {Provided by the SAO/NASA Astrophysics Data System} -} \ No newline at end of file +} + +@Article{abegaz2012, + title= "{Semiparametric estimation of conditional copulas}", + author = {Abegaz, Fentaw and Gijbels, Ir{\`e}ne and Veraverbeke, No{\"e}l}, + journal = {Journal of Multivariate Analysis}, + volume = {110}, + pages = {43--73}, + year = {2012}, + publisher = {Elsevier} +} From ce819ddbe8585072800b5b8b23b6531795014df0 Mon Sep 17 00:00:00 2001 From: Santymax98 <132070198+Santymax98@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:03:12 -0300 Subject: [PATCH 3/4] Update paper.md --- joss/paper.md | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/joss/paper.md b/joss/paper.md index b901f449a..38e245a1b 100644 --- a/joss/paper.md +++ b/joss/paper.md @@ -108,36 +108,6 @@ using Turing Turing.Turing.@addlogprob! loglikelihood(D, dataset) end ``` -Outside the common context we can use the API to work on different aspects, suppose you want to generate random samples of a copula whose parameter depends on a covariate $X$ [@abegaz2012], for example, Consider the Frank copula whose parameter depends on a covariate $X$ that follows a truncated normal distribution with mean zero and variance 9. Also, consider the parameter $\theta(x), x \in [-2,2]$. -```julia -using Distributions, Copulas, DataFrames - -x= truncated(Normal(0,3),-2,2) - -function model_1(x) - return (10-1.5x^2) -end - -data = rand(x,10^5) - -#Frank Copula whose parameter depends on a covariate -function rFrank(x, C_function, dimension) - data_list = DataFrame(u1=Float64[], u2=Float64[]) - - for i in x - param = C_function(i) - copula_instance = FrankCopula(dimension, param) - value_copula = rand(copula_instance, 1) - push!(data_list, (value_copula[1], value_copula[2])) - end - - return data_list -end - -New_frank = rFrank(data, model_1, 2) -``` -In this way we easily obtain random samples of a new bivariate Frank copula whose parameter can depend on any covariate. - ## The Archimedean interface Archimedean copulas form a large class of copulas that has seen a lot of theoretical work. Among others, you may take a look at [@mcneilMultivariateArchimedeanCopulas2009b]. We use [`WilliamsonTransforms.jl`](https://github.com/lrnv/WilliamsonTransforms.jl/)'s implementation of the Williamson $d$-transfrom to sample from any archimedean copula, including for example the `ClaytonCopula` with negative dependence parameter in any dimension, which is a first to our knowledge. From 728b1d254607421fd6c2eed13a0db86757b2823c Mon Sep 17 00:00:00 2001 From: CompatHelper Julia Date: Sun, 25 Feb 2024 00:51:35 +0000 Subject: [PATCH 4/4] CompatHelper: bump compat for TaylorSeries to 0.17, (keep existing compat) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a9fe397e9..560cd26d2 100644 --- a/Project.toml +++ b/Project.toml @@ -38,7 +38,7 @@ Roots = "1, 2" SpecialFunctions = "2" StableRNGs = "1" StatsBase = "0.33, 0.34" -TaylorSeries = "0.12, 0.13, 0.14, 0.15, 0.16" +TaylorSeries = "0.12, 0.13, 0.14, 0.15, 0.16, 0.17" Test = "1.6" TestItemRunner = "v0.2" WilliamsonTransforms = "0.1"