Learn R Programming

RandVar (version 1.2.4)

RandVariable-class: Random variable

Description

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”.

Arguments

Objects from the Class

Objects can be created by calls of the form new("RandVariable", ...). More frequently they are created via the generating function RandVariable.

Slots

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.

Methods

Map

signature(object = "RandVariable"): accessor function for the slot Map.

Domain

signature(object = "RandVariable"): accessor function for the slot Domain.

Range

signature(object = "RandVariable"): accessor function for the slot Range.

Map<-

signature(object = "RandVariable"): replacement function for the slot Map.

Domain<-

signature(object = "RandVariable"): replacement function for the slot Domain.

Range<-

signature(object = "RandVariable"): replacement function for the slot Range.

compatibleDomains

signature(e1 = "RandVariable", e2 = "RandVariable"): test if the domains of two random variables are compatible.

length

signature(object = "RandVariable"): length of the list of functions in slot Map.

show

signature(object = "RandVariable")

Author

Matthias Kohl Matthias.Kohl@stamats.de

See Also

RandVariable, EuclRandVariable-class, EuclRandMatrix-class, EuclRandVarList-class

Examples

Run this code
(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)

Run the code above in your browser using DataLab