I have two variables: Wind speed (MPH) and passing yards in the NFL. I want to test if wind speed has a statistically significant effect on a player's passing yards.

I used independent t-test from scipy (this function) and got a p-value of 2.308298987276122e-84, which seems too low? I tested the function on some random variables that should have no connection (like 'year' and 'week of season') and got a p-value of 0, so am I misunderstanding the t-test or something?

  • $\begingroup$ It's not clear what you did - you might want to post your code. $\endgroup$ Jan 20, 2020 at 3:27

1 Answer 1


That test is to see if the means of two samples are different from each other. So what you really tested is if the average wind speed is different from the average number of passing yards.

If you want to see the effect of windspeed on passing yards, what I would suggest is building a linear regression model, where wind speed is the independent variable, and passing yards is the dependent variable (there are a bunch of good tutorials on how to do linear regression in python). Then you can test if the wind speed coefficient is different from 0 using a t-test. If it is, you can conclude that it's likely that wind speed has an effect on passing yards.

You can do this using linear regression from statsmodel in python. Then you can print an output (using model.summary()) that looks like the following:

enter image description here

The coefficients are in the green, blue, and purple boxes. The results of a t-test for significance of each coefficient is already done for you. So where the blue box is, you'll see 'Wind speed'. Then move across that row to the column 'P>|t|'. If that value is less than 0.05, it's likely that wind speed has an effect on passing yards. For reference, in the image posted, we would conclude that both Interest_Rate and Unemployment_Rate have an effect on the Stock_Index_Price, since we see 0.005 for P>|t| for Interest_Rate, and 0.046 for P >|t| for Umeployment_Rate, both of which are smaller than 0.05.

You should keep in mind that there might be lurking and/or confounding variables though. There might be some other variables that are actually causing the changes in passing yards that you haven't accounted for. Ideally, you'd fit a large model, with lots of variables (wind speed being one of them), and then see if wind speed is significant in estimating passing yards, or if passing yards is explained by other variables.

But if you're trying to keep it simple (and I'm not sure how much data you have either), I would start with a simple linear regression model with just passing yards and wind speed.

  • $\begingroup$ Thanks! Can you just elaborate on this part: "Then you can test if the wind speed coefficient is different from 0 using a t-test." I understand everything else other than this $\endgroup$
    – user271350
    Jan 20, 2020 at 1:12
  • $\begingroup$ Just updated my response to have some details on how to do the t-test (really it's already done for you - you just need to know how to interpret it, if you use statsmodel) $\endgroup$ Jan 20, 2020 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.