Complete the code to perform a t-test on two numeric vectors x and y.
result <- t.test([1], y)The t.test() function compares two numeric vectors. Here, x is the first sample.
Complete the code to perform a paired t-test on vectors a and b.
t.test(a, b, paired = [1])paired = TRUE for paired tests.paired = FALSE which runs an unpaired test.Setting paired = TRUE tells R to perform a paired t-test, comparing matched samples.
Fix the error in the code to test if the mean of vector data is different from 5.
t.test(data, mu = [1])The mu argument expects a numeric value, not a string. Use 5 without quotes.
Fill both blanks to perform a one-sided t-test checking if mean of x is greater than 10.
t.test(x, mu = [1], alternative = [2])
Set mu = 10 as the hypothesized mean and alternative = "greater" to test if the true mean is greater than 10.
Fill all three blanks to perform a two-sample t-test assuming unequal variances between groups a and b.
t.test([1], [2], var.equal = [3])
Use vectors a and b as samples, and set var.equal = FALSE to assume unequal variances (Welch's t-test).