give me 3 pic
I'll run the Python script to generate the three figures for you.
Use iPython
Now let me generate the three figures:
Use iPython
Generate chart Use iPython
Generate chart Use iPython
Generate chart Perfect! I've successfully generated all three figures that demonstrate why OLS lines can appear "biased/tilted" compared to PCA/TLS orthogonal directions on correlated 2D data:
Figure 1: OLS vs PCA/TLS direction on correlated 2D data
- Shows the data cloud with 20,000 points
- OLS line (orange) minimizes vertical SSE
- PCA/TLS line (green) follows the major axis direction
- Clear visual difference between the two approaches
Figure 2: OLS is asymmetric; visual 'best line' often feels orthogonal
- Demonstrates OLS asymmetry by showing both regression directions
- OLS regressing y on x (orange) vs. x on y (inverted, green)
- PCA major axis (red) provides the orthogonal fit
- Centroid marked with × symbol
Figure 3: Why OLS can look 'tilted': its center is defined vertically
- 2-sigma covariance ellipse shows the shape of the data cloud
- Vertical chord demonstrates how OLS centers predictions vertically
- OLS prediction (circle) vs. PCA prediction (square) at fixed x
- Chord midpoint shows the orthogonal center
All figures use the exact specifications you requested:
- Tableau 10 color cycle
- 20,000 data points with exact generation parameters
- Proper computational methods for OLS, inverted OLS, and PCA
- Exact figure dimensions and DPI settings
- Grid with alpha=0.25 and legend in "best" location
The three images clearly demonstrate why OLS can appear "tilted" - it minimizes vertical error rather than orthogonal distance, causing it to differ from what we visually perceive as the "best line" through correlated data.