polyh_rbichibarsq_gen
and polyh_rbichibarsq_ineq
generate
n
by 2
matrices such that the rows form iid samples
from a bivariate chi-bar-squared distribution.
polyh_rbichibarsq_gen(n, A, solver = "nnls", reduce = TRUE, tol = 1e-07) polyh_rbichibarsq_ineq(n, A, solver = "nnls", reduce = TRUE, tol = 1e-07)
n | number of samples |
---|---|
A | matrix |
solver | either "nnls" or "mosek" |
reduce | logical; if |
tol | tolerance used in the reduction step (single precision machine epsilon by default) |
The outputs of polyh_rbichibarsq_gen(n,A)
and
polyh_rbichibarsq_ineq(n,A)
, with the default value
reduce==TRUE
, are lists containing the following elements:
dimC
: the dimension of the linear span of C
,
linC
: the lineality of the cone C
,
QL
: an orthogonal basis of the lineality space of C
,
set to NA
if lineality space is zero-dimensional,
QC
: an orthogonal basis of the projection of C
onto
the orthogonal complement of the lineality space of C
,
set to NA
if C
is a linear space,
A_reduced
: a matrix defining the reduced cone,
samples
: an n
by 2
matrix whose rows form
iid samples from the bivariate chi-bar-squared distribution with
weights given by the intrinsic volumes of the reduced cone
(either {A_reduced x|x>=0}
or {y|A_reduced^Ty<=0}
);
set to NA
if C
is a linear space.
If reduce==FALSE
then the output is only an
n
by 2
matrix such that its rows form
iid samples from the bivariate chi-bar-squared distribution with
weights given by the intrinsic volumes of the cone,
either {Ax|x>=0}
or {y|A^Ty<=0}
The bivariate chi-bar-squared distribution correponds to
the polyhedral cone C
given by the matrix A
,
either through its columns spanning the cone, C={Ax|x>=0}
,
or through its rows giving the inequalities of the cone, C={y|A^Ty<=0}
.
If reduce==TRUE
(default), then a
reduced form of the cone will be computed and the bivariate chi-bar-squared
distribution will correspond to the reduced form, and the output will contain
further elements (in form of a list).
polyh_rbichibarsq_gen
: Interprets A
as generator matrix of the cone,
that is, the cone is given by {Ax|x>=0}
; the
matrix A_reduced
defines the reduced cone
in the same way.
polyh_rbichibarsq_ineq
: Interprets A
as inequality matrix of the cone,
that is, the cone is given by {y|A^Ty<=0}
; the
matrix A_reduced
defines the reduced cone
in the same way.
See this vignette for further info.
Package: conivol
# using the 'generators' interpretation set.seed(1234) out_gen <- polyh_rbichibarsq_gen(20, matrix(1:12,4,3)) print(out_gen)#> $dimC #> [1] 2 #> #> $linC #> [1] 0 #> #> $QL #> [1] NA #> #> $QC #> [,1] [,2] #> [1,] -0.4036176 -0.7328662 #> [2,] -0.4647441 -0.2898498 #> [3,] -0.5258707 0.1531666 #> [4,] -0.5869972 0.5961831 #> #> $A_reduced #> [,1] [,2] #> [1,] -5.258707 -21.1085440 #> [2,] 1.531666 -0.6552639 #> #> $samples #> [,1] [,2] #> [1,] 1.533975e+00 0.0000000 #> [2,] 0.000000e+00 6.6783104 #> [3,] 5.551115e-17 0.4402406 #> [4,] 3.497823e-01 0.2793501 #> [5,] 3.502225e-01 0.7605509 #> [6,] 2.580036e-01 0.9664848 #> [7,] 6.067250e-01 0.0000000 #> [8,] 0.000000e+00 0.9327917 #> [9,] 2.905595e-01 0.8008483 #> [10,] 2.188455e+00 4.3486610 #> [11,] 0.000000e+00 0.2587523 #> [12,] 3.041442e-01 0.1011607 #> [13,] 5.451173e-01 2.0334279 #> [14,] 2.220446e-16 1.3782152 #> [15,] 1.951103e-03 0.8742778 #> [16,] 0.000000e+00 1.4412487 #> [17,] 5.251195e-01 0.2294453 #> [18,] 2.770685e+00 1.2465949 #> [19,] 4.931055e+00 1.6197807 #> [20,] 9.523882e-02 0.2084306 #>set.seed(1234) sampmos_gen <- polyh_rbichibarsq_gen(20, out_gen$A_reduced, solver="mosek", reduce=FALSE) print(sampmos_gen)#> [,1] [,2] #> [1,] 1.533975e+00 0.0000000 #> [2,] 1.195207e-23 6.6783104 #> [3,] 7.842405e-20 0.4402406 #> [4,] 3.497823e-01 0.2793501 #> [5,] 3.502225e-01 0.7605509 #> [6,] 2.580036e-01 0.9664848 #> [7,] 6.067250e-01 0.0000000 #> [8,] 8.623750e-27 0.9327917 #> [9,] 2.905595e-01 0.8008483 #> [10,] 2.188455e+00 4.3486610 #> [11,] 5.037283e-14 0.2587523 #> [12,] 3.041442e-01 0.1011607 #> [13,] 5.451173e-01 2.0334279 #> [14,] 4.276286e-24 1.3782152 #> [15,] 1.951181e-03 0.8742778 #> [16,] 3.620700e-18 1.4412487 #> [17,] 5.251195e-01 0.2294453 #> [18,] 2.770685e+00 1.2465949 #> [19,] 4.931055e+00 1.6197807 #> [20,] 9.523882e-02 0.2084306sum( (out_gen$samples - sampmos_gen)^2 )#> [1] 1.495264e-14# using the 'inequalities' interpretation set.seed(1234) out_ineq <- polyh_rbichibarsq_ineq(20, matrix(1:12,4,3)) print(out_ineq)#> $dimC #> [1] 4 #> #> $linC #> [1] 2 #> #> $QL #> [1] NA #> #> $QC #> [,1] [,2] #> [1,] -0.4036176 -0.7328662 #> [2,] -0.4647441 -0.2898498 #> [3,] -0.5258707 0.1531666 #> [4,] -0.5869972 0.5961831 #> #> $A_reduced #> [,1] [,2] #> [1,] -5.258707 -21.1085440 #> [2,] 1.531666 -0.6552639 #> #> $samples #> [,1] [,2] #> [1,] 0.0000000 1.533975e+00 #> [2,] 6.6783104 0.000000e+00 #> [3,] 0.4402406 5.551115e-17 #> [4,] 0.2793501 3.497823e-01 #> [5,] 0.7605509 3.502225e-01 #> [6,] 0.9664848 2.580036e-01 #> [7,] 0.0000000 6.067250e-01 #> [8,] 0.9327917 0.000000e+00 #> [9,] 0.8008483 2.905595e-01 #> [10,] 4.3486610 2.188455e+00 #> [11,] 0.2587523 0.000000e+00 #> [12,] 0.1011607 3.041442e-01 #> [13,] 2.0334279 5.451173e-01 #> [14,] 1.3782152 2.220446e-16 #> [15,] 0.8742778 1.951103e-03 #> [16,] 1.4412487 0.000000e+00 #> [17,] 0.2294453 5.251195e-01 #> [18,] 1.2465949 2.770685e+00 #> [19,] 1.6197807 4.931055e+00 #> [20,] 0.2084306 9.523882e-02 #>set.seed(1234) sampmos_ineq <- polyh_rbichibarsq_ineq(20, out_ineq$A_reduced, solver="mosek", reduce=FALSE) print(sampmos_ineq)#> [,1] [,2] #> [1,] 0.0000000 1.533975e+00 #> [2,] 6.6783104 1.195207e-23 #> [3,] 0.4402406 7.842405e-20 #> [4,] 0.2793501 3.497823e-01 #> [5,] 0.7605509 3.502225e-01 #> [6,] 0.9664848 2.580036e-01 #> [7,] 0.0000000 6.067250e-01 #> [8,] 0.9327917 8.623750e-27 #> [9,] 0.8008483 2.905595e-01 #> [10,] 4.3486610 2.188455e+00 #> [11,] 0.2587523 5.037283e-14 #> [12,] 0.1011607 3.041442e-01 #> [13,] 2.0334279 5.451173e-01 #> [14,] 1.3782152 4.276286e-24 #> [15,] 0.8742778 1.951181e-03 #> [16,] 1.4412487 3.620700e-18 #> [17,] 0.2294453 5.251195e-01 #> [18,] 1.2465949 2.770685e+00 #> [19,] 1.6197807 4.931055e+00 #> [20,] 0.2084306 9.523882e-02sum( (out_ineq$samples - sampmos_ineq)^2 )#> [1] 1.495264e-14