In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to implement T-test based on R language. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
A Test Method in Statistics Based on R Realization--T Test
preface
The t-test, also known as student's t test, is mainly used for normal distributions with small sample sizes (e.g., n < 30) and unknown population standard deviation σ. T test is to use t distribution theory to infer the probability of difference, so as to compare whether the difference between two means is significant.
1. applicable conditions
A population mean is known; a sample mean and standard deviation for that sample are obtained; the sample is from a normal or nearly normal population.
Note: If the individual sample T-test, must give a standard value or population mean, at the same time, provide a group of quantitative observation results, the premise of the application of t-test is that the group of data must obey the normal distribution; if the paired sample T-test, the difference between each pair of data must obey the normal distribution; if the independent sample T-test, the individuals are independent, the two groups of data are taken from the population of normal distribution, and meet the homogeneity of variance. These preconditions are needed because the calculated t-statistic must obey the t-distribution under such preconditions, and the t-test is the test method based on the t-distribution. In the latter analysis of variance, the preconditions for the independent sample T test are the same, i.e., the normality variance homogeneity.
2. Classification
One-population T-test (one-sample T-test), Two-population T-test (one-sample T-test, paired-sample T-test)
Note: The difference between individual sample T-check and independent sample T-test. The One-Samples T Test is used to compare the population mean of the sample with the known population mean, and the Independent-Samples T Test is used to compare the mean of two samples.
3.R Examples
-------#Single Sample T Test #------------- #The average oxygen content of a fish pond water for many years is 4.5mg/L. Now, 10 points are set for collecting water samples from the fish pond to determine the oxygen content in the water (unit: mg/L), respectively: #4.33, 4.62, 3.89, 4.14, 4.78, 4.64, 4.52, 4.55, 4.48, 4.26. Ask if there is a significant difference between the oxygen content in the water sampled this time and the average value for many years. Sites0.05, It is considered that the oxygen content of the sampled water body is not significantly different from the multi-year average value------#Independent sample T-test #--------#There are two cases, one is that the variance of two populations is homogeneous, and the other is that the variance of two populations is not homogeneous.################# Homogeneity of variance of two samples #Rats of 1 month old were fed with high protein and low protein diets. After 3 months of feeding, the weight gain (g) of two groups of rats was determined. The data of two groups were shown as follows: #High protein group: 134, 146, 106, 119, 124, 161, 107, 83, 113, 129, 97, 123 #Low protein group: 70, 118, 101, 85, 107, 132, 94 #Is there a significant difference in the weight gain of rats raised on two kinds of feeds? High
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.