vinecopulib / rvinecopulib

R interface to the vinecopulib C++ library
GNU General Public License v3.0
34 stars 9 forks source link

add variable names to vinecop summary #276

Closed tnagler closed 1 week ago

tnagler commented 3 months ago
> u <- replicate(3, runif(50))
> 
> # no names
> summary(vinecop(u))
# A data.frame: 3 x 11 
 tree edge conditioned conditioning var_types family rotation parameters df tau loglik
    1    1        2, 1                    c,c  indep        0             0   0      0
    1    2        1, 3                    c,c  indep        0             0   0      0
    2    1        2, 3            1       c,c  indep        0             0   0      0
> summary(vine(u))
$margins
# A data.frame: 3 x 6 
 margin name nobs   bw loglik d.f.
      1   V1   50 0.31   -4.7  2.4
      2   V2   50 0.31   -3.8  2.4
      3   V3   50 0.36   -5.8  2.3

$copula
# A data.frame: 3 x 11 
 tree edge conditioned conditioning var_types family rotation parameters df tau loglik
    1    1        2, 1                    c,c  indep        0             0   0      0
    1    2        1, 3                    c,c  indep        0             0   0      0
    2    1        2, 3            1       c,c  indep        0             0   0      0

> 
> # with names
> colnames(u) <- c("x", "y", "z")
> summary(vinecop(u))
# A data.frame: 3 x 11 
 tree edge conditioned conditioning var_types family rotation parameters df tau loglik
    1    1        2, 1                    c,c  indep        0             0   0      0
    1    2        1, 3                    c,c  indep        0             0   0      0
    2    1        2, 3            1       c,c  indep        0             0   0      0

---
1 <-> x,   2 <-> y,   3 <-> z 
> summary(vine(u))
$margins
# A data.frame: 3 x 6 
 margin name nobs   bw loglik d.f.
      1    x   50 0.31   -4.7  2.4
      2    y   50 0.31   -3.8  2.4
      3    z   50 0.36   -5.8  2.3

$copula
# A data.frame: 3 x 11 
 tree edge conditioned conditioning var_types family rotation parameters df tau loglik
    1    1        2, 1                    c,c  indep        0             0   0      0
    1    2        1, 3                    c,c  indep        0             0   0      0
    2    1        2, 3            1       c,c  indep        0             0   0      0

---
1 <-> x,   2 <-> y,   3 <-> z 
tvatter commented 2 months ago

Could/should something similar be done for vinecopulib?