{"body":"import numpy as np\nimport pandas as pd\nimport statsmodels.api as sm\n\n# Sample data\ndata = {\n    'Year': [2010, 2011, 2012, 2013, 2014, 2015],\n    'New_Home_Sales': [321, 361, 388, 442, 501, 550],\n    'Durable_Goods_Orders': [125, 130, 135, 140, 145, 150],\n    'Unemployment_Claims': [550, 520, 490, 460, 430, 400],\n    'GDP': [14.87, 15.23, 15.6, 16.15, 16.91, 17.4]\n}\n\ndf = pd.DataFrame(data)\n\n# Define the features and target variable\nX = df[['New_Home_Sales', 'Durable_Goods_Orders', 'Unemployment_Claims']]\ny = df['GDP']\n\n# Add a constant term to the features\nX = sm.add_constant(X)\n\n# Create and fit the multiple regression model\nmodel = sm.OLS(y, X)\nresults = model.fit()\n\n# Print the regression results\nprint(results.summary())\n\n# Forecast GDP for a new set of data\nnew_data = {\n    'New_Home_Sales': [590, 630, 670],\n    'Durable_Goods_Orders': [155, 160, 165],\n    'Unemployment_Claims': [370, 340, 320]\n}\n\nnew_df = pd.DataFrame(new_data)\n\n# Add a constant term to the new data\nnew_X = sm.add_constant(new_df)\n\n# Make predictions using the fitted model\nnew_predictions = results.predict(new_X)\n\n# Print the predicted GDP values\nprint(\"Predicted GDP:\")\nfor i in range(len(new_predictions)):\n    print(f\"Input: {new_df.iloc[i]}, Predicted GDP: {new_predictions[i]}\")\n","name":"GDP forecast","extension":"txt","url":"https://www.irccloud.com/pastebin/ziSfSGZD/GDP+forecast","modified":1687271197,"id":"ziSfSGZD","size":1274,"lines":48,"own_paste":false,"theme":"","date":1687271197}