t-test in R-How to Perform, Student’s t-test is the deviation of the estimated mean from its population mean expressed in terms of standard error. In this article talking about how to perform a t-test in R, its assumptions, and major properties.

## Assumptions about t-test:-

Majorly five assumptions for the t-test.

- Random variable x follow or normal distribution or sample is drawn from a normal population.
- All observations in the sample are independent.
- The sample size is small means that less than 30 and each group should not contain less than five observations.
- The hypothetical value of u0 of u is a correct value of the population mean.
- Sample observations are correctly measured and recorded

paired t test tabled value vs p value statistical analysis

### Properties:-

The two major properties of t-test

- t-Test is a robust test, which means a test that is not vitiated if assumptions do not fully hold good.
- Most powerful unbiased test

Wilcoxon Signed Rank Test in R » an Overview »

### When to use t-test?

The test can be used for comparing two sample means. If more than 2 groups use ANOVA and followed by Tukey HSD or Dunnet multiple comparison test.

#### Types of t-Test:-

Different types of the t-test are available, which one needs to use?

- Need to consider sample type, one sample, two samples, or paired sample.
- If single sample before and after kind of test using paired t-test.
- If two different independent samples use a two-sample t-test.
- If one group is compared against a standard value, ie the weight of the group is 65kg or <65 kg or >65 kg using a one-sample t-test.

#### One-tailed or two-tailed t-test?

If you only care whether the two populations are different from one another, perform a two-tailed t-test.

If you want to know whether one population mean is greater than or less than the other, perform a one-tailed t-test.

Kruskal Wallis test in R-One-way ANOVA Alternative »

### How to perform a t-test in R?

x1 = rnorm(10) x2 = rnorm(10) t.test(x1, x2 )

**Welch two-sample t-test**

When using the welch two-sample t-test, it assumes unequal sample variances in each group.

data: x1 and x2

t = 1.6, df = 16.2, p-value =0.234 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.33 1.6 sample estimates: mean of x1 0.2444 mean of x2 -0.4533

## Conclusion:

p-value is > 0.05 indicates no significant difference was observed between samples at 95%.

*Enjoyed this tutorial? Don’t forget to show your love, Please Subscribe the Newsletter and COMMENT below!*