- Training Systems Using Python Statistical Modeling
- Curtis Miller
- 234字
- 2021-06-24 14:20:45
Testing with two samples
If we assume that our data was drawn from normal distributions, the t-test can be used. For this test, we can use the statsmodels function, ttest_ind(). This is a more stable function from the package, and uses a different interface. So, here, we're going to test for a common mean.
Let's assume that your company has decided to stop outsourcing resistor production, and they're experimenting with different methods so that they can start producing resistors in-house. So, they have process A and process B, and they want you to test whether the mean resistance for these two processes is the same, or whether they're different. Therefore, you feel safe, assuming again that the resistance level of resistors is normally distributed regardless of whatever manufacturing process is employed, and you don't assume that they have the same standard deviation. Thus, the test statistic is as follows:

So, let's use this test statistic to perform your test:
Our first step is to load in the data, as follows:

Our next step is to load and define the ttest_ind function, as follows:

This will give us a p value. In this case, the p value is 0.659—this is a very large p value. It suggests that we should not reject the null hypothesis, and it appears that the two processes produce resistors with the same mean level of resistance.
- 數(shù)據(jù)科學(xué)實(shí)戰(zhàn)手冊(R+Python)
- 微信公眾平臺與小程序開發(fā):從零搭建整套系統(tǒng)
- 測試驅(qū)動開發(fā):入門、實(shí)戰(zhàn)與進(jìn)階
- Oracle從新手到高手
- Java高并發(fā)核心編程(卷2):多線程、鎖、JMM、JUC、高并發(fā)設(shè)計(jì)模式
- JavaScript+jQuery網(wǎng)頁特效設(shè)計(jì)任務(wù)驅(qū)動教程(第2版)
- PaaS程序設(shè)計(jì)
- SQL for Data Analytics
- Java:Data Science Made Easy
- AppInventor實(shí)踐教程:Android智能應(yīng)用開發(fā)前傳
- Quantum Computing and Blockchain in Business
- Node.js開發(fā)指南
- Mastering AWS Security
- MATLAB GUI純代碼編寫從入門到實(shí)戰(zhàn)
- Offer來了:Java面試核心知識點(diǎn)精講(框架篇)