subset: Subsets of Probability Spaces

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This is a method for subset() for the case when the input object is a probability space of class ps.

Usage

1
2
3
4
subset(x, ...)

## S3 method for class 'ps'
subset(x, subset, ...)

Arguments

x

a probability space.

subset

logical expression indicating elements or rows of space to keep: missing values are taken as false.

...

further arguments to be passed to or from other methods.

Details

This function simply extends the existing subset() function to ps objects.

Value

A ps object, a subset of a probability space.

Author(s)

G. Jay Kerns gkerns@ysu.edu.

See Also

intersect, setdiff, union, isin

Examples

1
2
3
4
5
L <- tosscoin(2)
M <- urnsamples(L, 3)
N <- probspace(M)
subset(N, all(toss1=="H"))
subset(N, any(toss2=="T"))

Example output

Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: fAsianOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fOptions


Rmetrics Package fOptions
Pricing and Evaluating Basic Options
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: hypergeo
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines

Attaching package: 'VGAM'

The following object is masked from 'package:hypergeo':

    is.zero

The following object is masked from 'package:fAsianOptions':

    erf


Attaching package: 'prob'

The following objects are masked from 'package:base':

    intersect, setdiff, union

$outcomes
list()

$probs
numeric(0)

attr(,"class")
[1] "ps"   "list"
$outcomes
$outcomes[[1]]
  toss1 toss2
1     H     H
2     T     H
3     H     T

$outcomes[[2]]
  toss1 toss2
1     H     H
2     T     H
4     T     T

$outcomes[[3]]
  toss1 toss2
1     H     H
3     H     T
4     T     T

$outcomes[[4]]
  toss1 toss2
2     T     H
3     H     T
4     T     T


$probs
[1] 0.25 0.25 0.25 0.25

attr(,"class")
[1] "ps"   "list"

prob documentation built on May 2, 2019, 12:20 p.m.