![]() |
VOOZH | about |
In R, a parametric test is a statistical method that makes specific assumptions about the population distribution, often assuming normality, equal variance and interval or ratio scale. These tests are typically more powerful when assumptions are satisfied and are widely used in hypothesis testing, mean comparisons and variance analysis.
R provides several parametric tests used when the data meet the assumptions required for parametric methods. These tests are suitable for normally distributed, continuous and interval-scale data.
The T-Test in R is used to compare means and test hypotheses about population means. It assumes the data is approximately normally distributed and comes in three main forms: one-sample, two-sample (independent) and paired t-test.
1.1 One-Sample t-Test
The One-Sample t-Test is used to check if the mean of a sample is different from a known or hypothesized value.
Syntax:
t.test(x, mu = value)
Example: The One-Sample t-Test checks if the mean of a given sample is equal to 28. We are testing whether the sampleβs mean is different from 28.
Output:
1.2 Two-Sample t-Test (Independent t-Test)
The Two-Sample t-Test is used to compare the means of two independent groups. It assumes equal variances and normal distribution.
Syntax:
t.test(x, y)
x and y represent the two groups.
Example: The Two-Sample t-Test compares the means of group1 and group2 to see if they are different.
Output:
1.3 Paired t-Test
The Paired t-Test is used to compare means from the same group at different times or under two different conditions.
Syntax:
t.test(x, y, paired = TRUE)
Example: The Paired t-Test compares before and after values to test if there is a significant difference between them.
Output:
The ANOVA test is used to compare the means of three or more independent groups to determine if there are any statistically significant differences.
Syntax:
aov(response ~ factor, data = dataset)
Example: The ANOVA test compares scores across three groups A, B and C to check for any differences.
Output:
The Pearson Correlation Test is used to assess the strength and direction of the linear relationship between two continuous variables.
Syntax:
cor.test(x, y, method = "pearson")
Example: The Pearson Correlation Test measures the linear correlation between variables x and y.
Output:
The F-Test is used to compare the variances of two samples to determine if they are different.
Syntax:
var.test(x, y)
x and y represent the samples.Example: The F-Test checks if group1 and group2 have equal variances.
Output:
The Z-Test is used to determine whether there is a difference between sample and population means when the population variance is known and the sample size is large (n > 30).
Syntax:
BSDA::z.test(x, mu = value, sigma.x = sd)
Example: The Z-Test checks if the mean of the sample differs significantly from 75, assuming known population standard deviation.
Output:
The Durbin-Watson Test is used to detect the presence of autocorrelation in the residuals from a regression analysis.
Syntax:
lmtest::dwtest(model)
Example: The Durbin-Watson Test checks for autocorrelation in the residuals of a simple linear regression model.
Output:
A Durbin-Watson statistic of 2.4602 with a p-value of 0.5534 indicates no positive autocorrelation in the residuals, so we fail to reject the null hypothesis.