Homework 8
Note: You must show all of your R codes to receive full credit for each problem.
2
1. Let () = (5)
(a): Use R to write function f(x). (5 points)
(b): Use R to write f(x), the first derivative of f(x). (5 points)

Homework 10
Note: You must show all of your R codes to receive full credit for each problem.
1. Use importance sampling to estimate ( 4 ), where () = 2|10| , < < .
(10 points)

Homework 5
Note: You must show all of your R codes to receive full credit for each problem.
1. Use Monte Carlo method to approximate ( 2 ), where X follows U(0,1). (5 points)
2. Use Monte Carlo method to approximate ( 4 ), where X follows N(0,1). (5 point

Homework 3
Note: You must show all of your R codes to receive full credit for each problem.
1. Use for() loop to generate a sequence A, such that A[i]=A[i-1]+A[i+1] for i>1. Suppose the length
of A is 100, A[1]=90, A[2]=10. (10 points)
2. Use while() loop

Homework 4
Note: You must show all of your R codes to receive full credit for each problem.
1. If X is a binomial random variable with expected value 6 and variance 2.4, use R to find
Pcfw_X=4. (6 points)
2. If X is normal random variable with expected va

Homework 7
Note: You must show all of your R codes to receive full credit for each problem.
1. One study collected data on the speech of 42 women and 37 men. The mean number of
words spoken per day by the women was 14,297 with a sample standard deviation

Homework 6
Note: You must show all of your R codes to receive full credit for each problem.
1. Statistical software has a random number generator that is supposed to produce
numbers uniformly distributed between 0 and 1. If this is true, the numbers gener

Homework 9
Note: You must show all of your R codes to receive full credit for each problem.
1. Use Newtons method to find the root of the first derivative of f(x). Use initial value
x=1. (15 points)
2. Use derivative test to determine whether the root you

Homework 2
Note: You must show all of your R codes to receive full credit for each problem.
1. Install and load R package MASS. Load data set cats. (2 points)
2. Generate a scatter plot of heart weight (x-axis) against body weight (y-axis), with
two diffe

Homework 1 (Due September 4 Friday, 2pm)
Note: You must show all of your R codes to receive full credit for each problem.
1. Use R to create a numeric vector of length 10. Calculate the sum, maximum,
minimum, mean, variance, and median. (5 points)
2. Use