Question
Do the following in the program R

Suppose a random variable X follows the Rayleigh d
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

Program screenhot of probability density function:

Sample output screenshot:

Code to copy:

set.seed(42)

# Calculate comulative distribution function

ecdf1 <- ecdf(rnorm(100)*0.5)

ecdf2 <- ecdf(rnorm(100)*1.0)

ecdf3 <- ecdf(rnorm(100)*2.0)

ecdf4 <- ecdf(rnorm(100)*3.0)

ecdf5 <- ecdf(rnorm(100)*4.0)

#attr(ecdf3,"call") <- "Cumulative Distribution Function"

plot(ecdf3, verticals=TRUE, do.points=FALSE, col='green')

plot(ecdf2, verticals=TRUE, do.points=FALSE, add=TRUE)

plot(ecdf1, verticals=TRUE, do.points=FALSE, add=TRUE, col='blue')

plot(ecdf5, verticals=TRUE, do.points=FALSE, add=TRUE, col='pink')

plot(ecdf4, verticals=TRUE, do.points=FALSE, add=TRUE, col='red')

b)

Program screenshot of comulative distribution function:

Sample output screenshot:

Code to copy:

set.seed(4000)

xseq<-seq(-8,10,.1)

par(mfrow=c(1,1), mar=c(3,4,4,3))

# Calculate probality density values

value1<-dnorm(xseq, 0,0.5)

value2<-dnorm(xseq, 0,1.0)

value3<-dnorm(xseq, 0,2.0)

value4<-dnorm(xseq, 0,3.0)

value5<-dnorm(xseq, 0,4.0)

# Display values in a grap using plot method

plot(xseq, value1, col="blue",xlab="", ylab="Density",main="Probability Density Fucntion is dnorm()" ,type="l",lwd=2, cex=2,cex.axis=.8)

# The method lines() is used ot attach the lines in a grap

lines(xseq, value2, col="black",xlab="", ylab="Density", type="l",lwd=2, cex=2,cex.axis=.8)

lines(xseq, value3, col="green",xlab="", ylab="Density", type="l",lwd=2, cex=2,cex.axis=.8)

lines(xseq, value4, col="red",xlab="", ylab="Density", type="l",lwd=2, cex=2,cex.axis=.8)

lines(xseq, value5, col="purple",xlab="", ylab="Density", type="l",lwd=2, cex=2,cex.axis=.8)


Add a comment
Know the answer?
Add Answer to:
Do the following in the program R Suppose a random variable X follows the Rayleigh distribution...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT