Whenever we note that we keep needing a certain sequence of commands, it’s good to put them into a function. The function body contains the instructions that we want to do over and over again, the function arguments take those things that we may want to vary.
Write a function to compute the probability of having a maximum as big as m when looking across n Poisson variables with rate lambda.
Write a function to compute the probability of having a maximum as big as m when looking across n Poisson variables with rate lambda.
I HOPE ITS HELP FUL TO YOU IF YOU HAVE ANY DOUBTS PLS COMMENTS BELOW..I WILL BE THERE TO HELP..ALL THE BEST..
Here’s example of one of such function. It takes m,n and lambda as arguments and returns 1 if maximum of n randomly generated number from Poisson lambda is as big as m, 0 if maximum is not as big as m
fun <- function(m,n lam)
{
x = rpois(n, lam)
return(ifelse(max(x)>=m),1,0))
I HOPE YOU UNDERSTAND...
PLS RATE THUMBS UP...ITS HELPS ME ALOT.....
THANK YOU....!!
Get Answers For Free
Most questions answered within 1 hours.