<jupyter_start><jupyter_text>---author: <NAME> (<EMAIL>)--- Let's assume that you already made your multivariate linear model,similar to the one shown below. If you still need to create one, first seehow to fit a multiple linear regression model.We use example data here, but you would use your own data instead.<jupyter_code>import pandas as pd
import statsmodels.api as sm
data = {
    'x1' : [ 2,  7,  4,  3, 11, 18,   6, 15,   9,  12],
    'x2' : [ 4,  6, 10,  1, 18, 11,   8, 20,  16,  13],
    'x3' : [11, 16, 20,  6, 14,  8,   5, 23,  13,  10],
    'y' :  [24, 60, 32, 29, 90, 45, 130, 76, 100, 120]
}<jupyter_output><empty_output><jupyter_text>The following code fits the model to the data.<jupyter_code>df = pd.DataFrame(data)
xs = df[['x1', 'x2', 'x3']]
y = df['y']
xs = sm.add_constant(xs)
model = sm.OLS(y, xs).fit()<jupyter_output>/opt/conda/lib/python3.9/site-packages/statsmodels/tsa/tsatools.py:142: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only
  x = pd.concat(x[::order], 1)<jupyter_text>Now we want to test whether the model is significant.  We will use a null hypothesisthat states that all of the model's coefficients are equal to zero, that is, they arenot jointly significant in predicting $y$.  We can write $H_0: \beta_0 = \beta_1 = \beta2 = \beta_3 = 0$.We also choose a value $0 \le \alpha \le 1$ as our Type 1 error rate. Herer we'll use$\alpha=0.05$.The summary output for the model will give us both the F-statistic and the p-value.<jupyter_code>model.summary()<jupyter_output>/opt/conda/lib/python3.9/site-packages/scipy/stats/stats.py:1541: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=10
  warnings.warn("kurtosistest only valid for n>=20 ... continuing "
{'fraction_non_alphanumeric': 0.13072625698324022, 'fraction_numerical': 0.05921787709497207, 'mean_word_length': 3.975, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '306321', 'license': 'MIT', 'n_tokens_mistral': 713, 'n_tokens_neox': 634, 'n_words': 232, 'path': 'database/tasks/How to do a test of joint significance/Python, using Statsmodels.ipynb', 'repo_name': 'nathancarter/how2data', 'size': '1819'}