diff --git a/lectures/lectures/data/fig/bias_good.png b/lectures/lectures/data/fig/bias_good.png new file mode 100644 index 0000000..ff20048 Binary files /dev/null and b/lectures/lectures/data/fig/bias_good.png differ diff --git a/lectures/lectures/data/fig/bias_variance.png b/lectures/lectures/data/fig/bias_variance.png new file mode 100644 index 0000000..c28d225 Binary files /dev/null and b/lectures/lectures/data/fig/bias_variance.png differ diff --git a/lectures/lectures/dynamics.html b/lectures/lectures/dynamics.html index 6635c8e..085d395 100644 --- a/lectures/lectures/dynamics.html +++ b/lectures/lectures/dynamics.html @@ -496,7 +496,7 @@

Fixed Points for Linear Functions

eigvals, eigvecs = eig(A) print(f"lambda_1={eigvals[0]}, ||x* - A x*||={norm(A @ eigvecs[:,0] - eigvecs[:,0])}")
-
lambda_1=(1+0j), ||x* - A x*||=1.5700924586837752e-16
+
lambda_1=(1+0j), ||x* - A x*||=1.1102230246251565e-16
diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-10-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-10-output-1.png index 1f72e10..814e2b0 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-10-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-10-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-12-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-12-output-1.png index 08ba60c..f00fb29 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-12-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-12-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-14-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-14-output-1.png index ba9218e..1df721e 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-14-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-14-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-15-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-15-output-1.png index 9dd76e6..693e24e 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-15-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-15-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-4-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-4-output-1.png index 1f72e10..814e2b0 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-4-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-4-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-6-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-6-output-1.png index 156f9f6..003a0c8 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-6-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-6-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-7-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-7-output-1.png index ebb840d..b25f5ab 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-7-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-7-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-8-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-8-output-1.png index 0295bda..a7cca46 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-8-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-8-output-1.png differ diff --git a/lectures/lectures/dynamics_files/figure-revealjs/cell-9-output-1.png b/lectures/lectures/dynamics_files/figure-revealjs/cell-9-output-1.png index c0bd645..1813409 100644 Binary files a/lectures/lectures/dynamics_files/figure-revealjs/cell-9-output-1.png and b/lectures/lectures/dynamics_files/figure-revealjs/cell-9-output-1.png differ diff --git a/lectures/lectures/eigenvalue_applications.html b/lectures/lectures/eigenvalue_applications.html index fa79c0e..0f7f29f 100644 --- a/lectures/lectures/eigenvalue_applications.html +++ b/lectures/lectures/eigenvalue_applications.html @@ -512,7 +512,7 @@

Iterating with \(\rho(A) > 1\)

rho(A) = 1.079128784747792
-x_200 = [3406689.32410674 6102361.18640517]
+x_200 = [3406689.32410673 6102361.18640516]
@@ -556,7 +556,7 @@

Iterating with \(\rho(A) = 1\)

print(f"x_{t} = {np.linalg.matrix_power(A, t) @ x_0}")
check orthogonal: dot(x_1,x_2) approx 0: 0.0
-rho(A) = 1.0000000000000002
+rho(A) = 1.0
 x_200 = [ 0.27639321 -0.17082039]
@@ -803,7 +803,7 @@

Condition Numbers of Matrices

print(f"condition(A) = {cond(A)}, condition(A^(-1)) = {cond(inv(A))}")
condition(I) = 1.0
-condition(A) = 40000001.939191714, condition(A^(-1)) = 40000002.00307444
+condition(A) = 40000001.962777555, condition(A^(-1)) = 40000002.02779216
@@ -859,8 +859,8 @@

Solving an Example

error using inv(A) = {norm(A @ c_inv - y, np.inf)}") print(f"cond(A) = {cond(A)}")
-
error = 5.820766091346741e-11, error using inv(A) = 1.3387762010097504e-09
-cond(A) = 564652.3214074654
+
error = 1.574562702444382e-11, error using inv(A) = 1.1932570487260818e-09
+cond(A) = 564652.3214000753
@@ -877,8 +877,8 @@

Things Getting Poorly Conditioned Quickly

error using inv(A) = {norm(A @ c_inv - y, np.inf)}") print(f"cond(A) = {cond(A)}")
-
error = 1.280568540096283e-09, error using inv(A) = 6.463262252509594e-06
-cond(A) = 4462817558043.969
+
error = 5.334186425898224e-10, error using inv(A) = 6.22717197984457e-06
+cond(A) = 4462824600234.486
@@ -895,8 +895,8 @@

Matrix Inverses Fail Completely for \(N = 20\)error using inv(A) = {norm(A @ c_inv - y, np.inf)}") print(f"cond(A) = {cond(A):.4g}")
-
error = 5.820766091346741e-10, error using inv(A) = 2460.8631448635133
-cond(A) = 5.771e+24
+
error = 6.784830475226045e-10, error using inv(A) = 31732.823760853855
+cond(A) = 1.697e+24
@@ -917,7 +917,7 @@

Moral of this Story

A_monomial = np.array([[x_i**n for n in range(N + 1)] for x_i in x]) # or np.vander print(f"cond(A) = {cond(A):.4g}, cond(A_monomial) = {cond(A_monomial):.4g}")
-
cond(A) = 3.64e+09, cond(A_monomial) = 1.694e+17
+
cond(A) = 3.64e+09, cond(A_monomial) = 2.926e+18
diff --git a/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-11-output-1.png b/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-11-output-1.png index ac3110a..4da6fb9 100644 Binary files a/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-11-output-1.png and b/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-11-output-1.png differ diff --git a/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-8-output-1.png b/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-8-output-1.png index 0c5b73c..2ecf8f6 100644 Binary files a/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-8-output-1.png and b/lectures/lectures/eigenvalue_applications_files/figure-revealjs/cell-8-output-1.png differ diff --git a/lectures/lectures/index.html b/lectures/lectures/index.html index 9daada2..f9b3f06 100644 --- a/lectures/lectures/index.html +++ b/lectures/lectures/index.html @@ -136,6 +136,7 @@

Lectures

  • Probability, Conditioning, and Independence, Jupyter, PDF
  • Stochastic Processes, Jupyter, PDF
  • Intro to Causality, Jupyter, PDF
  • +
  • Uncertainty Quantification in Applied Economics, Jupyter, PDF
  • diff --git a/lectures/lectures/introduction_to_causality.html b/lectures/lectures/introduction_to_causality.html index f4abef8..3e1fa49 100644 --- a/lectures/lectures/introduction_to_causality.html +++ b/lectures/lectures/introduction_to_causality.html @@ -1061,19 +1061,6 @@

    Estimating Treatment Effects Without Randomization

    Estimating Treatment Effects Without Randomization

    -
    Singular Values (sqrt eigenvalues):
    -[25.0823  1.0254  0.6468]
    +[21.5216  0.8732  0.7096]
     Explained Variance (ordered):
    -[0.9977 0.0017 0.0007]
    +[0.9973 0.0016 0.0011]
    @@ -626,8 +626,8 @@

    Dimension Reduction with PCA

    print(f"Correlation of Z_1 to Z_hat_1 = {np.corrcoef(Z.T, Z_hat.T)[0,2]}") print(f"Correlation of Z_2 to Z_hat_2 = {np.corrcoef(Z.T, Z_hat.T)[1,3]}")
    -
    Correlation of Z_1 to Z_hat_1 = 0.9989685407197146
    -Correlation of Z_2 to Z_hat_2 = -0.622136330126575
    +
    Correlation of Z_1 to Z_hat_1 = 0.9987396670122092
    +Correlation of Z_2 to Z_hat_2 = -0.6413512732572132
    @@ -813,7 +813,7 @@

    Plotting Code with Seaborn

    plt.show()
    -

    +

    @@ -832,7 +832,7 @@

    k-means to Recover the Latent Groups

    corr = df["k"].corr(df["k_hat"]) print(f"Correlation between k and k_hat:{corr:.2f}")
    -
    Correlation between k and k_hat:-0.83
    +
    Correlation between k and k_hat:-0.93
    @@ -870,7 +870,7 @@

    Potentially Swap \(\hat{k}\) and Compare if x['k'] == x['k_hat'] else r'$k \neq \hat{k}$', axis=1)
    -
    Correlation now 0.8300415031127608
    +
    Correlation now 0.9300465034877902
    @@ -886,7 +886,7 @@

    Plotting the Uncovered Latent Groups

    plt.show()
    -

    +

    @@ -945,7 +945,7 @@

    Digging Deeper

    Lambda, Q = eig(A)
     print(np.real(Lambda))
    -
    [ 1.10000000e+00 -2.65486721e-09]
    +
    [ 1.10000000e+00 -2.65486733e-09]