Displaying 2 results from an estimated 2 matches for "m1star".
2011 Feb 17
1
Integrate with an indicator function
Hi all,
I have some some problem with regard to finding the integral of a
function containing an indicator function.
please see the code below:
func1 <- function(x, mu){
(mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)}
m1star <- function(x){
integrate(func1, lower = 0, upper = Inf,x)$val}
T <- function(x){
0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))}
func2 <- function(x,c){(T(x) <=c)*0.3*dnorm(x)}
func3 <- function(x,c){(T(x) <= c)*(0.3*dnorm(x)+0.7*m1star(x))}
numer <- function(c){
integrat...
2011 Feb 17
1
Integration with an Indicator Function in R
Hi all,
I have some some problem with regard to finding the integral of a
function containing an indicator function.
please see the code below:
func1 <- function(x, mu){
(mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)}
m1star <- function(x){
integrate(func1, lower = 0, upper = Inf,x)$val}
T <- function(x){
0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))}
func2 <- function(x,c){(T(x) <=c)*0.3*dnorm(x)}
func3 <- function(x,c){(T(x) <= c)*(0.3*dnorm(x)+0.7*m1star(x))}
numer <- function(c){
integrat...