<jupyter_start><jupyter_text>Modelos de Regresión Lineal Modelo con datos simuladosx: 100 valores distribuidos segun una N(1.5 , 2.5)Ye = 8 +2*x + ee= estara distribuido segun una N(0,0.8)<jupyter_code>import pandas as pd
import numpy as np
x = 1.5 + 2.5 * np.random.randn(100)
res = .8* np.random.randn(100)
y_pred = 8 + 2*x
y_act = 8 +2*x + res
x_list= x.tolist()
y_pred_list= y_pred.tolist()
y_act_list= y_act.tolist()

data = pd.DataFrame({
    "x":x_list,
    "y":y_act_list,
    "y_pred": y_pred_list
})
data.head()
import matplotlib.pyplot as plt
%matplotlib inline
y_mean=[np.mean(y_act) for i in range (1, len(x_list)+1)]
plt.plot(x,y_pred)
plt.plot(x,y_act,"ro")
plt.plot(x,y_mean,"g")
plt.title("Valor Acutal Vs Prediccion")
data["SSR"]= (data["y_pred"]-np.mean(y_act))**2
data["SSD"]= (data["y_pred"]-data["y"])**2
data["SST"]= (data["y"]-np.mean(y_act))**2
SSR= sum(data["SSR"])
SSD= sum(data["SSD"])
SST= sum(data["SST"])<jupyter_output><empty_output><jupyter_text>Error Estandar de los residuos (RSE)<jupyter_code>RSE= np.sqrt(SSD/(len(data)-2))
RSE
RSE/np.mean(data["y"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19516562220232767, 'fraction_numerical': 0.02954341987466428, 'mean_word_length': 6.259740259740259, 'pattern_counts': {'":': 3, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '135166', 'license': 'MIT', 'n_tokens_mistral': 543, 'n_tokens_neox': 520, 'n_words': 97, 'path': '3. Regresion Lineal/.ipynb_checkpoints/1. Linear Regression-checkpoint.ipynb', 'repo_name': 'JaimeAndresSalas/Ciencia-de-Datos', 'size': '1117'}