Question
Write your own function in R to perform a t-test (it may not use t.test). The t-test should be unpaired and you may assume that
Write your own function in R to perform a t-test (it may not use t.test). The t-test should be unpaired and
you may assume that the samples have equal variance. This function must have the following properties:
a. It should be able to do either a one-sample of two sample t-test and should be able to tell which is required
by whether the user gives one or two samples. hint: You can do this using an if-then structure and the
missing() function.
b. The user should be able to specify a choice of alternative hypotheses by giving arguments two-sided,
less, or greater. If no such alternative is given, then the default should be two-sided.
c. The user should be able to specify a parameter mu indicating the true value of the mean or difference in
means under the null hypothesis. If unspecified, the default should be mu=0.
d. The result should be a list with the value of the t-statistic and the p-value with a names attribute specifying
which is which.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started