Description
Chapter 4, Q7 on page 170 (with some changes)
1. Suppose that we wish to predict whether a given stock will issue a dividend this year (โYesโ or โNoโ) based on ๐, last yearโs percent profit. We examine a large number of companies and discover that the mean value of ๐ for companies that issued a dividend was ๐ฬ
= 10, while the mean for those that didnโt was ๐ฬ
= 0. In addition, the variance of ๐ for these two sets of companies was ๐ฬ2= 36. Finally, 80% of companies issued dividends. Assuming that ๐ follows a normal distribution, predict the probability that a company will issue a dividend this year given that its percentage profit was ๐ฟ = 4 last year. To answer this, first answer a) to e).
a) Write down what is P(๐ | Dividend = Yes) (3 marks)
b) Write down what is P(๐ | Dividend = No) (3 marks)
c) Use dnorm() function in R to calculate conditional probabilities in a) and b) when ๐ = 4 (4 marks, 2 marks each)
d) What is the value of P( Dividend = Yes)? (2 marks)
e) What is the value of P( Dividend = No)? (2 marks)
f) Now predict the probability that a company will issue a dividend this year given that its percentage profit was ๐ = 4 last year. Hint: Use Bayesโ rule as we discussed in the class. (6 marks)
Chapter 4, Q 11 on pp 171-172 (with some changes)
2. In this problem, you will develop a model to predict whether a given car gets high or low gas mileage based on the Auto data set.
(b) Which of the continuous features seem most likely to be useful in predicting mpg? Use cor() function in R and consider features with correlation coefficients > 0.6 as useful in predicting. (2 marks)
(c) Split the data into a training set and a test set holding 30% of data for testing. Use sample.split() function in the library โcaToolsโ in R to split the data with the random seed 101. Use set.seed() function in R to assign the random seed. (3 marks)
Reviews
There are no reviews yet.