SOLUTION: Let's directly calculate the 95% confidence intervals of our parameters. The formula for a given parameter is: 𝐢𝐼=(π›½βˆ’π‘§β‹…π‘ π‘›βŽ―βŽ―βˆš,𝛽+π‘§β‹…π‘ π‘›βŽ―β

Algebra ->  Probability-and-statistics -> SOLUTION: Let's directly calculate the 95% confidence intervals of our parameters. The formula for a given parameter is: 𝐢𝐼=(π›½βˆ’π‘§β‹…π‘ π‘›βŽ―βŽ―βˆš,𝛽+π‘§β‹…π‘ π‘›βŽ―β      Log On


   



Question 1135297: Let's directly calculate the 95% confidence intervals of our parameters. The formula for a given parameter is:
𝐢𝐼=(π›½βˆ’π‘§β‹…π‘ π‘›βŽ―βŽ―βˆš,𝛽+π‘§β‹…π‘ π‘›βŽ―βŽ―βˆš)
Where, 𝛽 is the coefficient, 𝑧 is the critical value(t-statistic required to obtain a probability less than the alpha significance level), and 𝑆𝐸𝑖,𝑖 is the Standard Error Matrix.
start = '2014-01-01'
end = '2015-01-01'
asset = get_pricing('KO', fields='price', start_date=start, end_date=end)
benchmark = get_pricing('PEP', fields='price', start_date=start, end_date=end)
X = asset.pct_change()[1:]
Y = benchmark.pct_change()[1:]
result = sm.OLS(Y,X).fit()
# Convert X to Matrix (adding columns of one)
X = np.vstack((X, np.ones( X.size ) ))
X = np.matrix( X )
# Matrix Multiplication and inverse calculation
C = np.linalg.inv( X * X.T )
C *= result.mse_resid
SE = np.sqrt(C) # Calucaltion of Standart Error.
# Critical Values of the t-statistic
N = result.nobs
P = result.df_model
dof = N - P - 1
z = scipy.stats.t(dof).ppf(0.975)
i = 0
## Your code goes here
# Fetch values of Beta and parameters of SE from the matrix
beta = ## Your code goes here
c = ## Your code goes here
print ## Your code goes here
## Instead of running the code above and calculate the CI step by step,
## you can get the CI automatically from OLS table.

Answer by ikleyn(53937) About Me  (Show Source):
You can put this solution on YOUR website!
.

Nonsense.

Not an appropriate post/problem/request for this forum.

Do not spend your time for nothing posting such requests - they make no sense.


Have a nice day / afternoon / evening / night / morning etc.