Description Usage Arguments Value Examples
This function is designed to find the expected value for g(x) or g(x, y) given a function g.
1 | Evalue(g, rv)
|
g |
the function that we are looking for expected value |
rv |
given random variables |
the expected value of the given function
1 2 3 4 5 6 7 8 9 10 11 12 13 | betaPDF <- function(x) {
ifelse(0 < x & x < 1, 2*x, 0)}
x1 = data.frame(oneDsample(f = betaPDF, N=10000, lb = 0, ub = 1))
g1 = function(x){x^2}
Evalue(g1,x1)
jointPDF <- function(x){
x1 = x[1]
x2 = x[2]
ifelse(0<x1 & x1 <1 & 0<x2 & x2<1 & 0<x1+x2 & x1+x2<1, 24*x1*x2, 0)}
xy = data.frame(twoDsample(f = jointPDF, N=10000, lbx=0, ubx=1, lby=0, uby=1))
g2 = function(x,y){x^2+y}
Evalue(g2,xy)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.