### All Weeks Python and Statistics for Financial Analysis Coursera Quiz Answers

Python is now becoming the number 1 programming language for data science. Due to python’s simplicity and high readability, it is gaining importance in the financial industry. The course combines both python coding and statistical concepts and applies to analyzing financial data, such as stock data.

#### Python and Statistics for Financial Analysis Coursera Quiz Answers

#### Week 1: Python and Statistics for Financial Analysis

Q1. Which of the following library has DataFrame object?

**Pandas**- Numpy
- Matplotlib
- Statsmodels

Q2. Which of the following is the correct way to import a library, eg Pandas?

`1.pandas import`

`1.include`

`1.pandas`

**1.import pandas as pd**

Q3. What is the method of DataFrame object to import a csv file?

- import_csv()
**from_csv()**- read_csv()
- csv()

Q4. Which of the following attributes of a DataFrame return a list of column names of this

DataFrame?

**columns**- shape
- dtype
- column

Q5. Which of the following can slice ‘Close’ from ‘2015-01-01’ to ‘2016-12-31’ from data,

which is a DataFrame object?

**1.data.loc[‘2015-01-01’:’2016-12-31’, ‘Close’]**

`1.data.iloc[‘2015-01-01’:’2016-12-31’, ‘Close’]`

Q6. What is the method of DataFrame to plot a line chart?

- scatter()
**plot()**- plot_graph()
- axhline()

Q7. Suppose you have a DataFrame – data, which

contains columns ‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj Close’ and ‘Volume’.

What

does data[[‘Open’, ‘Low’]] return?

- All

columns of data except ‘Open’ and ‘High’ - No results are shown
**Columns ‘Open’ and ‘Low’**- The first

row of data which contains only columns ‘Open’ and ‘High’

Q8. Suppose you have a DataFrame ms , which contains the daily data of ‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj

Close’ and ‘Volume’ of Microsoft’s stock.

Which of

the following syntax calculates the Price difference, (ie ‘Close’ of tomorrow –

‘Close’ of today)?

**1. ms[‘Close’].shift(1) – ms[‘Close’].shift(1)**

`1.ms[‘Close’].shift(-1) – ms[‘Close’].shift(-1)`

`1.ms[‘Close’].shift(1) – ms[‘Close’]`

`1.ms[‘Close’].shift(-1) – ms[‘Close’]`

Q9. Suppose you have a DataFrame – ms , which contains the daily data of ‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj

Close’ and ‘Volumn’ of Microsoft’s stock.

What is

the method of DataFrame to calculate the 60 days moving average?

- rolling().mean(60)
- moving_average(60)
**rolling(60).mean()**- rolling(60).median()

Q10. Which of the following idea(s) is/are correct to the simple trading strategy that we introduced in the lecture video?

**Use longer**

moving average as slow signal and shorter moving average as fast signal- We short

one share of stocks if fast signal is larger than slow signal **If fast**

signal is larger than slow signal, this indicates an upward trend at the

current moment

#### Week 2: Python and Statistics for Financial Analysis

Q1. Roll two dice and X is the sum of faces values. If we roll them 5 times and get 2,3,4,5,6

Which of the following is/are true about X?

- The mean of X is 4.
- X can only take values 2,3,4,5,6
**X is a**

random variable

Q2. Roll two dice and X is the sum of faces values. If we roll them 5 times and get 2,3,4,5,6

What do we know about X?

- The dice is fair.
- Range of X is 6-2=4
- The most likely value of X is 6
**We have 5 observations of X**

Q3. Roll two dice and X is the sum of faces values. If we roll them 5 times and get 2,3,4,5,6

X is a ** __** random variable.

**discrete**- continuous
- None of

the above

Q4. Why do we

use relative frequency instead of frequency?

- Relative
frequency is easier to compute - Frequency

cannot show the number of appearance of outcomes **Relative frequency can be used to compare the**

ratio of values between difference collections with difference number of values- Relative

frequency is easier to compute when the number of observations increases

Q5. What can

we say about relative frequency when we have large number of trials?

**Relative frequency becomes approximately the**

distribution of the corresponding random variable- The

relative frequency of each possible outcome will be the same - The relative

frequency stays constant after a very large number of trials, eg. n=10000 - None of the above

Q6. What is the notion of “95% Value at Risk” ?

- 95% Value

at Risk is 95% quantile - 95% VaR

measures how much you can lose at most - 95% VaR

measures how much you can win at most **95% VaR measures the amount of investment you can**

lose, at the worst 5% scenario

Q7. In the lecture video, we mentioned the calculation of continuous random variable is based on the probability density function.

Given a

probability density function, f(x) = 1/100, what is the probability

P(10<X<20), where X~Uniform[0, 100]?

- f(20) –

f(10) - f(10)
- f(20)
**(20- 10) * 1/100**

Q8. What

methods should we use to get the

cdf and pdf of normal distribution?

**norm.cdf() and norm.pdf() from scipy.stats**- cdf() and

pdf() form numpy - cdf() and

pdf() from pandas - norm.cdf()

and norm.pdf() from statsmodels

Q9. Which additional library should we import when we want to calculate log daily return specifically?

- Pandas
**Numpy**- Statsmodels
- Matplotlib

Q10. What

is the distribution of stock returns suggested by Fama and French in general?

- A perfect normal distribution
**Close to normal distribution but with fat tail**- Arbitrary distribution
- Left-skewed distribution

#### Week 3: Python and Statistics for Financial Analysis

Q1. What is true

about sample and population?

- Population

can always be directly observed - Parameters

from population is always the same as statistics from sample **Sample is a subset of population which is**

randomly draw from population- The size

of population is always finite

Q2. You have a

DataFrame called ‘data’ which has only one column ‘population’.

data = pd.DataFrame()

data[‘population’] = [47, 48, 85, 20, 19, 13, 72, 16, 50, 60]

How to draw sample with sample size =5, from a

‘population’ with replacement?

(Hint: You can modify the code illustrated in the Jupyter Notebook “Population and Sample” after Lecture 3.1)

`1.data[‘population’].sample(5, replace=False)`

`1.data[‘population’].sample(10)`

`1.data[‘population’].sample(5)`

**1.data[‘population’].sample(5, replace=True)**

Q3. Why is the

degrees of freedom n-1 in sample variance?

**The degrees of freedom in sample variance is**

constrained by the sample mean- None of

the above - The extreme value in the sample is removed for fair analysis
- Only n-1

values in the sample is useful

Q4. What does Central Limit Theorem tell you about the distribution of sample mean?

- The
distribution of sample mean follows normal distribution only if the population

distribution is normal - The

distribution of sample mean follows normal distribution with any sample size

only if the population distribution is normal **The distribution of sample mean follows normal**

distribution with very large sample size follows normal distribution regardless

of the population distribution- The

distribution of sample mean with large sample size follows chi-square

distribution regardless of the population distribution

Q5. Suppose we have 3 independent normal random variables X1, X2 and X3:

What is the distribution of X1 + X2 + X3?

- Remains the same even X1, X2 and X3 are added up
**Mean and variance of X1, X2 and X3 are added up**- Mean remains unchanged; variances are added up.
- Mean remains unchanged; variance takes 3 square root.

Q6. Why do we

need to standardize sample mean when making inference?

- Sample

mean becomes normally distributed after standardization - Sample

mean becomes population mean after standardization **The standardized distribution of sample mean follows N(0,1) which is easier to make inference**- None of the above

Q7. What can a 95%

confidence interval of daily return of an investment tell you?

- With 95% chance

your daily return falls into this interval **With 95% chance this interval will cover the mean of**

daily return- With 5% chance your

daily return falls into this interval - None of the above

Q8. Check the

Juypter notebook of 3.3 Sample and Inference. What is the confidence interval of this exercise?

- [0.000015603,

0.001656] **[-0.000015603, 0.001656]**- [-0.0001690,

0.001471] - [0.0001690,

0.001471]

Q9. When do you reject a null hypothesis with alternative hypothesis μ>0 with significance level α?

- p value is larger than α
**p value is smaller than α****z < z_(1-α)**- z > z_(1-α)

Q10. When doing analysis of stock return, you notice that with 95% confidence interval, the upper bound and lower bound are negative.

Base on this data, what can you tell about this stock?

**There is 95% chance of which the mean return of this stock is negative**- We must lose money by investing in this stock
- There is only 5% chance of which the mean return of this stock is negative

#### Week 4: Python and Statistics for Financial Analysis

Q1. Why do you use

coefficient of correlation, instead of covariance, when calculating the association between two random variables?

- None of the above
- Covariance is not

suitable to use when the underlying distribution is not normal - Covariance cannot

address nonlinear relationship but coefficient of correlation can address

nonlinear relationship **Covariance can be affected by the variance of**

individual variables, but coefficient of correlation is rescaled by variance of

both variables

Q2. What is the range

and interpretation of coefficient of correlation?

- From 0 to 1, 0

means perfect negative linear relationship and 1 means perfect positive linear

relationship - From 0 to 100, 0

means perfect positive linear relationship and 100 means perfect negative

linear relationship - From 0 to 100, 0

means perfect negative linear relationship and 100 means perfect positive

linear relationship **From -1 to 1, -1 means perfect negative linear**

relationship and 1 means perfect positive linear relationship

Q3. Refer to the https://www.coursera.org/learn/python-statistics-financial-analysis/notebook/F0Luf/simple-linear-regression-model

Is LSTAT a significant predictor of MEDV at significance level 0.05?

- Yes, because the coefficient b_1 is not zero
- Yes, because the p value of b_1 is larger than 0.05
- No, because the coefficient b_1 is negative
**Yes, because the p value of b_1 is smaller than 0.05**

Q4. To evaluate the performance of linear regression model, we refer to the summary of “model” as seen in https://www.coursera.org/learn/python-statistics-financial-analysis/notebook/F0Luf/simple-linear-regression-model

What is the percentage of variation explained by the model?

- 0.95
**0.54**- 0.46
- 0.829

Q5. How to check if a

linear regression model violates the independence assumption?

- Draw residual

versus predictor plot - Draw scatter plot

of predictor versus target **Durbin Watson test**- QQ plot

Q6. If any of the

assumptions of linear regression model are violated, we cannot use this model

to make prediction.

- True
**False**

Q7. Check the Jupyter Notebook 4.4- Build the trading model by yourself!

We have a variable ‘formula’ which store the names of predictors

and target. How should you modify this ‘formula’ if you want to drop the

predictor ‘daxi’?

`1.formula = ‘spy~aord+cac40+nikkei+dji+daxi’`

`1.formula = ‘spy~aord+cac40+nikkei+dji-daxi’`

**1.formula = ‘spy~aord+cac40+nikkei+dji’**

`1.formula = ‘spy~ -daxi’`

Q8. Check the Jupyter Notebook 4.4- Build the trading model by yourself!

What is the most

significance predictor for ‘SPY’?

- nikkei
- dji
**arod**- cac40

Q9. What does it mean

if you have a strategy with maximum drawdown of 3%?

- During the

trading period, the minimum you lose is 3% - During the

trading period, the maximum gain from the previous peak of your portfolio value

is 3% - During the trading period, the maximum lose of

your portfolio is 3% **During the trading period, the maximum drop from the**

previous peak of your portfolio value is 3%

Q10. How can you check

the consistency of your trading strategy?

- Check if the

return of your strategy is positive using all historical data you have - Define some

metric for evaluating your strategy, eg Sharpe Ratio, maximum drawdown, and

check if your strategy can generate positive return using all historical data

you have **Define some metric for evaluating your strategy, eg**

Sharpe Ratio, maximum drawdown. Then split your data into train set and test

set and check if your strategy can generate positive return using both train

set and test set- There is no way to to check the consistency

##### Python and Statistics for Financial Analysis Coursera Course Review:

In our experience, we suggest you enroll in Python and Statistics for Financial Analysis courses and gain some new skills from Professionals completely free and we assure you will be worth it.

Python and Statistics for Financial Analysis course is available on Coursera for free, if you are stuck anywhere between quiz or graded assessment quiz, just visit Networking Funda to get Python and Statistics for Financial Analysis Coursera Quiz Answers.

##### Conclusion:

I hope this Python and Statistics for Financial Analysis Coursera Quiz Answers would be useful for you to learn something new from this Course. If it helped you then don’t forget to bookmark our site for more Coursera Quiz Answers.

This course is intended for audiences of all experiences who are interested in learning about new skills in a business context; there are no prerequisite courses.

Keep Learning!