Title: | Implementation of Random Variables |
---|---|
Description: | Implements random variables by means of S4 classes and methods. |
Authors: | Matthias Kohl [cre, cph, aut], Peter Ruckdeschel [aut, cph] |
Maintainer: | Matthias Kohl <[email protected]> |
License: | LGPL-3 |
Version: | 1.2.4 |
Built: | 2024-11-03 05:42:15 UTC |
Source: | https://github.com/r-forge/robast |
Implementation of random variables by means of S4 classes and methods.
Package: | RandVar |
Version: | 1.2.4 |
Date: | 2024-09-02 |
Depends: | R(>= 3.4), methods, distr(>= 2.8.0), distrEx(>= 2.8.0) |
Imports: | startupmsg |
ByteCompile: | yes |
License: | LGPL-3 |
URL: | https://r-forge.r-project.org/projects/robast/ |
VCS/SVNRevision: | 1261 |
Note: The first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the RobAStXXX family as a whole in order to ease updating "depends" information.
Peter Ruckdeschel [email protected],
Matthias Kohl [email protected]
Maintainer: Matthias Kohl [email protected]
M. Kohl (2005). Numerical Contributions to the Asymptotic Theory of Robustness. Dissertation. University of Bayreuth. See also https://www.stamats.de/wp-content/uploads/2018/04/ThesisMKohl.pdf
distr-package
, distrEx-package
library(RandVar) #vignette("RandVar")
library(RandVar) #vignette("RandVar")
Generates an object of class "EuclRandMatrix"
.
EuclRandMatrix(Map = list(function(x){1}), nrow = 1, ncol = 1, Domain = NULL, dimension = 1, Range)
EuclRandMatrix(Map = list(function(x){1}), nrow = 1, ncol = 1, Domain = NULL, dimension = 1, Range)
Map |
list of functions forming the map. |
nrow |
number of rows. |
ncol |
number of columns. |
Domain |
object of class |
dimension |
positive integer: dimension of the
range of |
Range |
object of class |
Object of class "EuclRandMatrix"
Matthias Kohl [email protected]
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- EuclRandMatrix(Map = L1, nrow = 3, Domain = Reals(), dimension = 1) R1[1:2, 2] R1[1:2, 1:2] Map(R1[1,2]) Map(t(R1)[2,1]) R2 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (DL <- imageDistr(R2, Norm())) plot(DL) Map(gamma(R2)) # "Math" group ## "Arith" group Map(2/R1) Map(R2 * R2) ## The function is currently defined as function(Map = list(function(x){1}), nrow = 1, ncol = 1, Domain = NULL, dimension = 1) { if (missing(nrow)) nrow <- ceiling(length(Map)/ncol) else if (missing(ncol)) ncol <- ceiling(length(Map)/nrow) if(missing(Range)) return(new("EuclRandMatrix", Map = Map, Domain = Domain, Range = EuclideanSpace(dimension = dimension), Dim = as.integer(c(nrow, ncol)))) else return(new("EuclRandMatrix", Map = Map, Domain = Domain, Range = Range, Dim = as.integer(c(nrow, ncol)))) }
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- EuclRandMatrix(Map = L1, nrow = 3, Domain = Reals(), dimension = 1) R1[1:2, 2] R1[1:2, 1:2] Map(R1[1,2]) Map(t(R1)[2,1]) R2 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (DL <- imageDistr(R2, Norm())) plot(DL) Map(gamma(R2)) # "Math" group ## "Arith" group Map(2/R1) Map(R2 * R2) ## The function is currently defined as function(Map = list(function(x){1}), nrow = 1, ncol = 1, Domain = NULL, dimension = 1) { if (missing(nrow)) nrow <- ceiling(length(Map)/ncol) else if (missing(ncol)) ncol <- ceiling(length(Map)/nrow) if(missing(Range)) return(new("EuclRandMatrix", Map = Map, Domain = Domain, Range = EuclideanSpace(dimension = dimension), Dim = as.integer(c(nrow, ncol)))) else return(new("EuclRandMatrix", Map = Map, Domain = Domain, Range = Range, Dim = as.integer(c(nrow, ncol)))) }
Class of Euclidean random matrices.
Objects can be created by calls of the form new("EuclRandMatrix", ...)
.
More frequently they are created via the generating function
EuclRandMatrix
.
Dim
vector of positive integers: Dimensions of the random matrix.
Map
Object of class "list"
: list of functions.
Domain
Object of class "OptionalrSpace"
domain of the random matrix.
Range
Object of class "OptionalrSpace"
range of the random matrix.
Class "EuclRandVariable"
, directly.
Class "RandVariable"
, by class "EuclRandVariable"
.
signature(from = "EuclRandMatrix", to = "EuclRandVarList")
:
create a "EuclRandVarList"
object from a Euclidean random matrix.
signature(x = "EuclRandMatrix")
: generates
a new Euclidean random variable/matrix by extracting elements of
the slot Map
of x
.
signature(object = "EuclRandMatrix")
: accessor function
for slot Dim
.
signature(object = "EuclRandMatrix", )
: replacement
function for slot Dim
.
signature(x = "EuclRandMatrix")
: number of columns of x
.
signature(x = "EuclRandMatrix")
: number of rows of x
.
signature(object = "EuclRandMatrix")
: dimension
of the Euclidean random variable.
signature(RandVar = "EuclRandMatrix", x = "numeric")
:
evaluate the slot Map
of RandVar
at x
.
signature(RandVar = "EuclRandMatrix", x = "matrix")
:
evaluate the slot Map
of RandVar
at x
.
signature(RandVar = "EuclRandMatrix", x = "numeric", distr = "Distribution")
:
evaluate the slot Map
of RandVar
at x
assuming
a probability space with distribution distr
. In case x
does not lie in the support of distr
NA
is returned.
signature(RandVar = "EuclRandMatrix", x = "matrix", distr = "Distribution")
:
evaluate the slot Map
of RandVar
at rows of x
assuming a probability space with distribution distr
. For those
rows of x
which do not lie in the support of distr
NA
is returned.
signature(x = "EuclRandMatrix")
: transposes x
. In
addition, the results of the functions in the slot Map
of
x
are transposed.
signature(object = "EuclRandMatrix")
signature(x = "matrix", y = "EuclRandMatrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "numeric", y = "EuclRandMatrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandVariable", y = "EuclRandMatrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandMatrix", y = "matrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandMatrix", y = "numeric")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandMatrix", y = "EuclRandMatrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandMatrix", y = "EuclRandVariable")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(e1 = "numeric", e2 = "EuclRandMatrix")
:
Given a numeric vector e1
, a Euclidean random matrix e2
and an arithmetic operator op
, the Euclidean random matrix
e1 op e2
is returned.
signature(e1 = "EuclRandMatrix", e2 = "numeric")
:
Given a Euclidean random matrix e1
, a numeric vector e2
,
and an arithmetic operator op
, the Euclidean random matrix
e1 op e2
is returned.
signature(e1 = "EuclRandMatrix", e2 = "EuclRandMatrix")
:
Given two Euclidean random matrices e1
and e2
,
and an arithmetic operator op
, the Euclidean random matrix
e1 op e2
is returned.
signature(x = "EuclRandMatrix")
:
Given a "Math"
group generic fct
, the Euclidean random
matrix fct(x)
is returned.
signature(object = "UnivariateDistribution", fun = "EuclRandMatrix", cond = "missing")
:
expectation of fun
under univariate distributions.
signature(object = "AbscontDistribution", fun = "EuclRandMatrix", cond = "missing")
:
expectation of fun
under absolutely continuous univariate distributions.
signature(object = "DiscreteDistribution", fun = "EuclRandMatrix", cond = "missing")
:
expectation of fun
under discrete univariate distributions.
signature(object = "MultivariateDistribution", fun = "EuclRandMatrix", cond = "missing")
:
expectation of fun
under multivariate distributions.
signature(object = "DiscreteMVDistribution", fun = "EuclRandMatrix", cond = "missing")
:
expectation of fun
under discrete multivariate distributions.
signature(object = "UnivariateCondDistribution", fun = "EuclRandMatrix", cond = "numeric")
:
conditional expectation of fun
under conditional univariate distributions.
signature(object = "AbscontCondDistribution", fun = "EuclRandMatrix", cond = "numeric")
:
conditional expectation of fun
under absolutely continuous conditional univariate distributions.
signature(object = "DiscreteCondDistribution", fun = "EuclRandMatrix", cond = "numeric")
:
conditional expectation of fun
under discrete conditional univariate distributions.
Matthias Kohl [email protected]
EuclRandMatrix
, RandVariable-class
,
EuclRandVariable-class
, EuclRandVarList-class
,
Distribution-class
, Arith
,
Math
, E
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandMatrix", Map = L1, Dim = as.integer(c(3,2)), Domain = Reals(), Range = Reals()) dimension(R1) R1[1:2, 2] R1[1:2, 1:2] Map(R1[1,2]) Map(t(R1)[2,1]) R2 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) dimension(R2) (DL <- imageDistr(R2, Norm())) plot(DL) Map(gamma(R2)) # "Math" group ## "Arith" group Map(2/R1) Map(R2 * R2)
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandMatrix", Map = L1, Dim = as.integer(c(3,2)), Domain = Reals(), Range = Reals()) dimension(R1) R1[1:2, 2] R1[1:2, 1:2] Map(R1[1,2]) Map(t(R1)[2,1]) R2 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) dimension(R2) (DL <- imageDistr(R2, Norm())) plot(DL) Map(gamma(R2)) # "Math" group ## "Arith" group Map(2/R1) Map(R2 * R2)
Generates an object of class "EuclRandVariable"
.
EuclRandVariable(Map = list(function(x){1}), Domain = NULL, dimension = 1, Range)
EuclRandVariable(Map = list(function(x){1}), Domain = NULL, dimension = 1, Range)
Map |
list of functions forming the map. |
Domain |
object of class |
dimension |
positive integer: dimension of the
range of |
Range |
object of class |
Object of class "EuclRandVariable"
Matthias Kohl [email protected]
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- EuclRandVariable(Map = L1, Domain = Reals(), dimension = 1) Map(R1) Range(R1) Range(R1) <- Reals() R1[2] Map(R1[3]) Map(R1[c(1,2,4)]) Map(R1[2:4]) set.seed(123) evalRandVar(R1, rnorm(1)) x <- as.matrix(rnorm(10)) res.R1 <- evalRandVar(R1, x) res.R1[2,,] # results for Map(R1)[[2]](x) res.R1[2,1,] # results for Map(R1)[[2]](x[1,]) R2 <- EuclRandVariable(L2, Domain = Reals(), dimension = 1) DL1 <- imageDistr(R2, Norm()) plot(DL1) Domain(R2) <- EuclideanSpace(dimension = 2) Range(R2) <- EuclideanSpace(dimension = 2) (X <- matrix(c(x, rnorm(10)), ncol = 2)) res.R2 <- evalRandVar(R2, X) res.R2[3,,1] # results for Map(R2)[[3]](X[,1]) Map(log(abs(R2))) # "Math" group generic # "Arith" group generic Map(3 + R1) Map(c(1,3,5) * R1) try(1:5 * R1) # error Map(1:2 * R2) Map(R2 - 5) Map(R1 ^ R1) ## The function is currently defined as function(Map = list(function(x){1}), Domain = NULL, dimension = 1, Range) { if(missing(Range)) return(new("EuclRandVariable", Map = Map, Domain = Domain, Range = EuclideanSpace(dimension = dimension))) else return(new("EuclRandVariable", Map = Map, Domain = Domain, Range = Range)) }
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- EuclRandVariable(Map = L1, Domain = Reals(), dimension = 1) Map(R1) Range(R1) Range(R1) <- Reals() R1[2] Map(R1[3]) Map(R1[c(1,2,4)]) Map(R1[2:4]) set.seed(123) evalRandVar(R1, rnorm(1)) x <- as.matrix(rnorm(10)) res.R1 <- evalRandVar(R1, x) res.R1[2,,] # results for Map(R1)[[2]](x) res.R1[2,1,] # results for Map(R1)[[2]](x[1,]) R2 <- EuclRandVariable(L2, Domain = Reals(), dimension = 1) DL1 <- imageDistr(R2, Norm()) plot(DL1) Domain(R2) <- EuclideanSpace(dimension = 2) Range(R2) <- EuclideanSpace(dimension = 2) (X <- matrix(c(x, rnorm(10)), ncol = 2)) res.R2 <- evalRandVar(R2, X) res.R2[3,,1] # results for Map(R2)[[3]](X[,1]) Map(log(abs(R2))) # "Math" group generic # "Arith" group generic Map(3 + R1) Map(c(1,3,5) * R1) try(1:5 * R1) # error Map(1:2 * R2) Map(R2 - 5) Map(R1 ^ R1) ## The function is currently defined as function(Map = list(function(x){1}), Domain = NULL, dimension = 1, Range) { if(missing(Range)) return(new("EuclRandVariable", Map = Map, Domain = Domain, Range = EuclideanSpace(dimension = dimension))) else return(new("EuclRandVariable", Map = Map, Domain = Domain, Range = Range)) }
Class of Euclidean random variables.
Objects can be created by calls of the form new("EuclRandVariable", ...)
.
More frequently they are created via the generating function
EuclRandVariable
.
Map
Object of class "list"
: list of functions.
Domain
Object of class "OptionalrSpace"
:
domain of the random variable.
Range
Object of class "EuclideanSpace"
:
range of the random variable.
Class "RandVariable"
, directly.
signature(from = "EuclRandVariable", to = "EuclRandMatrix")
:
create a "EuclRandMatrix"
object from a Euclidean random variable.
signature(from = "EuclRandVariable", to = "EuclRandVarList")
:
create a "EuclRandVarList"
object from a Euclidean random variable.
signature(object = "EuclRandVariable")
:
replacement function for the slot Range
.
signature(x = "EuclRandVariable")
: generates
a new Euclidean random variable by extracting elements of
the slot Map
of x
.
signature(RandVar = "EuclRandVariable", x = "numeric", distr = "missing")
:
evaluate the slot Map
of RandVar
at x
.
signature(RandVar = "EuclRandVariable", x = "matrix", distr = "missing")
:
evaluate the slot Map
of RandVar
at rows of x
.
signature(RandVar = "EuclRandVariable", x = "numeric", distr = "Distribution")
:
evaluate the slot Map
of RandVar
at x
assuming
a probability space with distribution distr
. In case x
does not lie in the support of distr
NA
is returned.
signature(RandVar = "EuclRandVariable", x = "matrix", distr = "Distribution")
:
evaluate the slot Map
of RandVar
at rows of x
assuming a probability space with distribution distr
. For those
rows of x
which do not lie in the support of distr
NA
is returned.
signature(RandVar = "EuclRandVariable", distr = "Distribution")
:
image distribution of distr
under RandVar
. Returns
an object of class "DistrList"
.
signature(object = "EuclRandVariable")
:
dimension of the Euclidean random variable.
signature(x = "EuclRandVariable")
:
returns an object of class "EuclRandMatrix"
where the
rhe results of the functions in the slot Map
of x
are transposed.
signature(x = "matrix", y = "EuclRandVariable")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandVariable", y = "matrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "numeric", y = "EuclRandVariable")
:
generates an object of class "EuclRandMatrix"
(1 x 1 matrix)
by multiplying (scalar/innner product) x
and y
.
signature(x = "EuclRandVariable", y = "numeric")
:
generates an object of class "EuclRandMatrix"
(1 x 1 matrix)
by multiplying (scalar/innner product) x
and y
.
signature(x = "EuclRandVariable", y = "EuclRandVariable")
:
generates an object of class "EuclRandMatrix"
(1 x 1 matrix)
by multiplying (scalar/innner product) x
and y
.
signature(x = "EuclRandVariable", y = "EuclRandMatrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandMatrix", y = "EuclRandVariable")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(e1 = "numeric", e2 = "EuclRandVariable")
:
Given a numeric vector e1
, a Euclidean random variable e2
and an arithmetic operator op
, the Euclidean random variable
e1 op e2
is returned.
signature(e1 = "EuclRandVariable", e2 = "numeric")
:
Given a numeric vector e2
, a Euclidean random variable e1
and an arithmetic operator op
, the Euclidean random variable
e1 op e2
is returned.
signature(e1 = "EuclRandVariable", e2 = "EuclRandVariable")
:
Given two Euclidean random variables e1
, e2
and an
arithmetic operator op
, the Euclidean random variable
e1 op e2
is returned.
signature(x = "EuclRandVariable")
:
Given a "Math"
group generic fct
, the Euclidean random
variable fct(x)
is returned.
signature(object = "UnivariateDistribution", fun = "EuclRandVariable", cond = "missing")
:
expectation of fun
under univariate distributions.
signature(object = "AbscontDistribution", fun = "EuclRandVariable", cond = "missing")
:
expectation of fun
under absolutely continuous univariate distributions.
signature(object = "DiscreteDistribution", fun = "EuclRandVariable", cond = "missing")
:
expectation of fun
under discrete univariate distributions.
signature(object = "MultivariateDistribution", fun = "EuclRandVariable", cond = "missing")
:
expectation of fun
under multivariate distributions.
signature(object = "DiscreteMVDistribution", fun = "EuclRandVariable", cond = "missing")
:
expectation of fun
under discrete multivariate distributions.
signature(object = "UnivariateCondDistribution", fun = "EuclRandVariable", cond = "numeric")
:
conditional expectation of fun
under conditional univariate distributions.
signature(object = "UnivariateCondDistribution", fun = "EuclRandVariable", cond = "numeric")
:
conditional expectation of fun
under absolutely continuous conditional univariate distributions.
signature(object = "UnivariateCondDistribution", fun = "EuclRandVariable", cond = "numeric")
:
conditional expectation of fun
under discrete conditional univariate distributions.
Matthias Kohl [email protected]
EuclRandVariable
, RandVariable-class
,
EuclRandMatrix-class
, EuclRandVarList-class
,
Distribution-class
, Arith
,
Math
, E
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L1, Domain = Reals(), Range = Reals()) dimension(R1) Map(R1) Range(R1) R1[2] Map(R1[3]) Map(R1[c(1,2,4)]) Map(R1[2:4]) set.seed(123) evalRandVar(R1, rnorm(1)) x <- as.matrix(rnorm(10)) res.R1 <- evalRandVar(R1, x) res.R1[2,,] # results for Map(R1)[[2]](x) res.R1[2,1,] # results for Map(R1)[[2]](x[1,]) R2 <- EuclRandVariable(L2, Domain = Reals(), dimension = 1) dimension(R2) DL1 <- imageDistr(R2, Norm()) plot(DL1) Domain(R2) <- EuclideanSpace(dimension = 2) Range(R2) <- EuclideanSpace(dimension = 2) dimension(R2) (X <- matrix(c(x, rnorm(10)), ncol = 2)) res.R2 <- evalRandVar(R2, X) res.R2[3,,1] # results for Map(R2)[[3]](X[,1]) Map(log(abs(R2))) # "Math" group generic # "Arith" group generic Map(3 + R1) Map(c(1,3,5) * R1) try(1:5 * R1) # error Map(1:2 * R2) Map(R2 - 5) Map(R1 ^ R1)
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L1, Domain = Reals(), Range = Reals()) dimension(R1) Map(R1) Range(R1) R1[2] Map(R1[3]) Map(R1[c(1,2,4)]) Map(R1[2:4]) set.seed(123) evalRandVar(R1, rnorm(1)) x <- as.matrix(rnorm(10)) res.R1 <- evalRandVar(R1, x) res.R1[2,,] # results for Map(R1)[[2]](x) res.R1[2,1,] # results for Map(R1)[[2]](x[1,]) R2 <- EuclRandVariable(L2, Domain = Reals(), dimension = 1) dimension(R2) DL1 <- imageDistr(R2, Norm()) plot(DL1) Domain(R2) <- EuclideanSpace(dimension = 2) Range(R2) <- EuclideanSpace(dimension = 2) dimension(R2) (X <- matrix(c(x, rnorm(10)), ncol = 2)) res.R2 <- evalRandVar(R2, X) res.R2[3,,1] # results for Map(R2)[[3]](X[,1]) Map(log(abs(R2))) # "Math" group generic # "Arith" group generic Map(3 + R1) Map(c(1,3,5) * R1) try(1:5 * R1) # error Map(1:2 * R2) Map(R2 - 5) Map(R1 ^ R1)
Generates an object of class "EuclRandVarList"
.
EuclRandVarList(...)
EuclRandVarList(...)
... |
Objects of class |
Object of class "EuclRandVarList"
Matthias Kohl [email protected]
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L2, Domain = Reals(), Range = Reals()) R2 <- EuclRandMatrix(Map = L1, ncol = 2, Domain = Reals(), dimension = 1) R3 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (RL1 <- EuclRandVarList(R1, R2, R3)) is(R1, "EuclRandVarList") as(R1, "EuclRandVarList") is(R2, "EuclRandVarList") as(R2, "EuclRandVarList") Map(exp(RL1)[[1]]) # "Math" group ## "Arith" group Map((1 + RL1)[[1]]) Map((RL1 * 2)[[2]]) Map((RL1 / RL1)[[3]]) ## The function is currently defined as function(...){ new("EuclRandVarList", list(...)) }
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L2, Domain = Reals(), Range = Reals()) R2 <- EuclRandMatrix(Map = L1, ncol = 2, Domain = Reals(), dimension = 1) R3 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (RL1 <- EuclRandVarList(R1, R2, R3)) is(R1, "EuclRandVarList") as(R1, "EuclRandVarList") is(R2, "EuclRandVarList") as(R2, "EuclRandVarList") Map(exp(RL1)[[1]]) # "Math" group ## "Arith" group Map((1 + RL1)[[1]]) Map((RL1 * 2)[[2]]) Map((RL1 / RL1)[[3]]) ## The function is currently defined as function(...){ new("EuclRandVarList", list(...)) }
Create a list of Euclidean random variables
Objects can be created by calls of the form new("EuclRandVarList", ...)
.
More frequently they are created via the generating function
EuclRandVarList
.
.Data
Object of class "list"
. A list of Euclidean
random variables.
Class "list"
, from data part.
Class "vector"
, by class "list"
.
signature(from = "EuclRandVariable", to = "EuclRandVarList")
:
create a "EuclRandVarList"
object from a Euclidean random variable.
signature(from = "EuclRandMatrix", to = "EuclRandVarList")
:
create a "EuclRandVarList"
object from a Euclidean random matrix.
signature(object = "EuclRandVarList")
:
number of functions contained in the slots Map
of
the members of object
.
signature(object = "EuclRandVarList")
:
dimension of the Euclidean random variable.
signature(RandVar = "EuclRandVarList", x = "numeric")
:
evaluate the elements of RandVar
at x
.
signature(RandVar = "EuclRandVarList", x = "matrix")
:
evaluate the elements of RandVar
at rows of x
.
signature(RandVar = "EuclRandVarList", x = "numeric", distr = "Distribution")
:
evaluate the elements of RandVar
at x
assuming
a probability space with distribution distr
. In case x
does not lie in the support of distr
NA
is returned.
signature(RandVar = "EuclRandVarList", x = "matrix", distr = "Distribution")
:
evaluate the elements of RandVar
at rows of x
assuming a probability space with distribution distr
. For those
rows of x
which do not lie in the support of distr
NA
is returned.
signature(RandVar = "EuclRandVarList", distr = "Distribution")
:
image distribution of distr
under RandVar
. Returns
an object of class "DistrList"
.
signature(object = "EuclRandVarList")
signature(x = "EuclRandVarList")
:
returns an object of class "EuclRandVarList"
where the
rhe results of the functions in the slots Map
of the members of
x
are transposed.
signature(x = "EuclRandVarList", y = "EuclRandVarList")
:
matrix multiplication for objects of class "EuclRandVarList"
.
Generates an object of class "EuclRandVarList"
.
signature(x = "matrix", y = "EuclRandVarList")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(x = "EuclRandVarList", y = "matrix")
:
matrix multiplication of x
and y
. Generates
an object of class "EuclRandMatrix"
.
signature(e1 = "numeric", e2 = "EuclRandVarList")
:
Given a numeric vector e1
, a list of Euclidean random variables e2
and an arithmetic operator op
, the list of Euclidean random variables
e1 op e2
is returned.
signature(e1 = "EuclRandVarList", e2 = "numeric")
:
Given a numeric vector e2
, a list of Euclidean random variables e1
and an arithmetic operator op
, the list of Euclidean random variables
e1 op e2
is returned.
signature(e1 = "EuclRandVarList", e2 = "EuclRandVarList")
:
Given two lists of Euclidean random variables e1
, e2
and an
arithmetic operator op
, the list of Euclidean random variables
e1 op e2
is returned.
signature(x = "EuclRandVarList")
:
Given a "Math"
group generic fct
, the list of Euclidean random
variables fct(x)
is returned.
signature(object = "UnivariateDistribution", fun = "EuclRandVarList", cond = "missing")
:
expectation of fun
under univariate distributions.
signature(object = "AbscontDistribution", fun = "EuclRandVarList", cond = "missing")
:
expectation of fun
under absolutely continuous univariate distributions.
signature(object = "DiscreteDistribution", fun = "EuclRandVarList", cond = "missing")
:
expectation of fun
under discrete univariate distributions.
signature(object = "MultivariateDistribution", fun = "EuclRandVarList", cond = "missing")
:
expectation of fun
under multivariate distributions.
signature(object = "DiscreteMVDistribution", fun = "EuclRandVarList", cond = "missing")
:
expectation of fun
under discrete multivariate distributions.
signature(object = "UnivariateCondDistribution", fun = "EuclRandVarList", cond = "numeric")
:
expectation of fun
under conditional univariate distributions.
signature(object = "AbscontCondDistribution", fun = "EuclRandVarList", cond = "numeric")
:
expectation of fun
under absolutely continuous conditional univariate distributions.
signature(object = "DiscreteCondDistribution", fun = "EuclRandVarList", cond = "numeric")
:
expectation of fun
under discrete conditional univariate distributions.
Matthias Kohl [email protected]
EuclRandMatrix
, RandVariable-class
,
EuclRandVariable-class
, EuclRandMatrix-class
,
Distribution-class
, Arith
,
Math
, E
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L2, Domain = Reals(), Range = Reals()) R2 <- EuclRandMatrix(Map = L1, ncol = 2, Domain = Reals(), dimension = 1) R3 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (RL1 <- new("EuclRandVarList", list(R1, R2, R3))) dimension(RL1) as(R1, "EuclRandVarList") as(R2, "EuclRandVarList") Map(exp(RL1)[[1]]) # "Math" group ## "Arith" group Map((1 + RL1)[[1]]) Map((RL1 * 2)[[2]]) Map((RL1 / RL1)[[3]])
L1 <- list(function(x){x}, function(x){x^2}, function(x){x^3}, function(x){x^4}, function(x){x^5}, function(x){x^6}) L2 <- list(function(x){exp(x)}, function(x){abs(x)}, function(x){sin(x)}, function(x){floor(x)}) R1 <- new("EuclRandVariable", Map = L2, Domain = Reals(), Range = Reals()) R2 <- EuclRandMatrix(Map = L1, ncol = 2, Domain = Reals(), dimension = 1) R3 <- EuclRandMatrix(Map = L2, ncol = 2, Domain = Reals(), dimension = 1) (RL1 <- new("EuclRandVarList", list(R1, R2, R3))) dimension(RL1) as(R1, "EuclRandVarList") as(R2, "EuclRandVarList") Map(exp(RL1)[[1]]) # "Math" group ## "Arith" group Map((1 + RL1)[[1]]) Map((RL1 * 2)[[2]]) Map((RL1 / RL1)[[3]])
Optional object of class "rSpace"
.
A virtual Class: No objects may be created from it.
Matthias Kohl [email protected]
Generates an object of class "RandVariable"
.
RandVariable(Map = list(function(x){}), Domain = NULL, Range = NULL)
RandVariable(Map = list(function(x){}), Domain = NULL, Range = NULL)
Map |
list of functions forming the map. |
Domain |
domain of |
Range |
range of |
Object of class "RandVariable"
Matthias Kohl [email protected]
(R1 <- RandVariable()) Map(R1) Domain(R1) Range(R1) Map(R1) <- list(function(x){ceiling(x)}, function(x){floor(x)}) Domain(R1) <- Reals() Range(R1) <- Naturals() R1 Map(R1) length(R1) R2 <- R1 Domain(R2) <- Naturals() compatibleDomains(R1, R2) Domain(R2) <- NULL compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 1) compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 2) compatibleDomains(R1, R2) ## The function is currently defined as function(Map = list(function(x){ }), Domain = NULL, Range = NULL) { return(new("RandVariable", Map = Map, Domain = Domain, Range = Range)) }
(R1 <- RandVariable()) Map(R1) Domain(R1) Range(R1) Map(R1) <- list(function(x){ceiling(x)}, function(x){floor(x)}) Domain(R1) <- Reals() Range(R1) <- Naturals() R1 Map(R1) length(R1) R2 <- R1 Domain(R2) <- Naturals() compatibleDomains(R1, R2) Domain(R2) <- NULL compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 1) compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 2) compatibleDomains(R1, R2) ## The function is currently defined as function(Map = list(function(x){ }), Domain = NULL, Range = NULL) { return(new("RandVariable", Map = Map, Domain = Domain, Range = Range)) }
Class of random variables; i.e., measurable maps from
Domain
to Range
. The elements contained in
the list Map
are functions in one(!) argument named “x”.
Objects can be created by calls of the form new("RandVariable", ...)
.
More frequently they are created via the generating function
RandVariable
.
Map
Object of class "list"
: list of functions.
Domain
Object of class "OptionalrSpace"
:
domain of the random variable.
Range
Object of class "OptionalrSpace"
:
range of the random variable.
signature(object = "RandVariable")
:
accessor function for the slot Map
.
signature(object = "RandVariable")
:
accessor function for the slot Domain
.
signature(object = "RandVariable")
:
accessor function for the slot Range
.
signature(object = "RandVariable")
:
replacement function for the slot Map
.
signature(object = "RandVariable")
:
replacement function for the slot Domain
.
signature(object = "RandVariable")
:
replacement function for the slot Range
.
signature(e1 = "RandVariable", e2 = "RandVariable")
:
test if the domains of two random variables are compatible.
signature(object = "RandVariable")
:
length of the list of functions in slot Map
.
signature(object = "RandVariable")
Matthias Kohl [email protected]
RandVariable
, EuclRandVariable-class
,
EuclRandMatrix-class
, EuclRandVarList-class
(R1 <- new("RandVariable")) Map(R1) Domain(R1) Range(R1) Map(R1) <- list(function(x){ceiling(x)}, function(x){floor(x)}) Domain(R1) <- Reals() Range(R1) <- Naturals() R1 Map(R1) length(R1) R2 <- R1 Domain(R2) <- Naturals() compatibleDomains(R1, R2) Domain(R2) <- NULL compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 1) compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 2) compatibleDomains(R1, R2)
(R1 <- new("RandVariable")) Map(R1) Domain(R1) Range(R1) Map(R1) <- list(function(x){ceiling(x)}, function(x){floor(x)}) Domain(R1) <- Reals() Range(R1) <- Naturals() R1 Map(R1) length(R1) R2 <- R1 Domain(R2) <- Naturals() compatibleDomains(R1, R2) Domain(R2) <- NULL compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 1) compatibleDomains(R1, R2) Domain(R2) <- EuclideanSpace(dimension = 2) compatibleDomains(R1, R2)
Generates an object of class "RealRandVariable"
.
RealRandVariable(Map = list(function(x) {1}), Domain = NULL, Range)
RealRandVariable(Map = list(function(x) {1}), Domain = NULL, Range)
Map |
list of functions forming the map. |
Domain |
domain of |
Range |
range of |
Object of class "RealRandVariable"
Matthias Kohl [email protected]
RealRandVariable(Map = list(function(x){x}), Domain = Reals()) ## The function is currently defined as function(Map = list(function(x){1}), Domain = NULL, Range) { if(missing(Range)) Range <- Reals() if(!is(Range, "Reals")) stop("'Range' has to be of class 'Reals'") return(new("RealRandVariable", Map = Map, Domain = Domain, Range = Reals())) }
RealRandVariable(Map = list(function(x){x}), Domain = Reals()) ## The function is currently defined as function(Map = list(function(x){1}), Domain = NULL, Range) { if(missing(Range)) Range <- Reals() if(!is(Range, "Reals")) stop("'Range' has to be of class 'Reals'") return(new("RealRandVariable", Map = Map, Domain = Domain, Range = Reals())) }
Class of real random variables.
Objects can be created by calls of the form new("RealRandVariable", ...)
.
More frequently they are created via the generating function
EuclRandVariable
.
Map
Object of class "list"
: list of functions.
Domain
Object of class "OptionalrSpace"
:
domain of the random variable.
Range
Object of class "Reals"
:
range of the random variable.
Class "EuclRandVariable"
, directly.
Class "RandVariable"
, by class "EuclRandVariable"
.
signature(object = "EuclRandVariable")
:
replacement function for the slot Range
.
Matthias Kohl [email protected]
new("RealRandVariable", Map=list(function(x){x}), Range = Reals())
new("RealRandVariable", Map=list(function(x){x}), Range = Reals())