Gprob: Conditional Probability Calculation

Description Usage Arguments Value Examples

Description

This function is designed to calculate the probabilities realted to X or X and Y.

Usage

1
Gprob(cd, data)

Arguments

cd

the given conditions

data

the samples obtained from rejection sampling

Value

the value of probability realted to X or X and Y

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
f <- function(x) {ifelse(0 < x & x < 1, 4*x^3, 0)}
x1 = oneDsample(f,10000)
c1 = function(x){x<0.4}
Gprob(c1,x1)

f <- function(x){
x1 = x[1]
x2 = x[2]
ifelse(x2>0, 1/pi/(1+x1^2) * 0.05*exp(-0.05*x2), 0)}
x2 = twoDsample(f = f, N=10000)
c2 = function(x,y){
 x<0.5 & y<0.2}
Gprob(c2,x2)

<<<<<<< HEAD
=======

>>>>>>> cdbb79a12f539e6c21a1ac083fd355a5f60e8def

pinhuang0317/4800.Final.Project-KC.P.Production- documentation built on May 28, 2019, 7:37 a.m.