Question

In: Statistics and Probability

What are some of the available commands that can be utilized in R for carrying out...

What are some of the available commands that can be utilized in R for carrying out a one-sample and two-sample t-test? What are the differences between carrying out a t-test with equal and unequal variance? Please provide an example to illustrate your assertions.

Solutions

Expert Solution

One sample t test

>t.test(dataset$sample1, mu=mu0)

The mu argument gives the value with which you want to compare the sample mean. It is optional and has a default value of zero.

By default, R performs a two-tailed test. To perform a one-tailed test, set the alternative argument to "greater" or "less", as shown below.

> t.test(dataset$sample1, mu=mu0, alternative="greater")


A 95% confidence interval for the population mean is included with the output. To adjust the size of the interval, use the conf.level argument.

> t.test(dataset$sample1, mu=mu0, conf.level=0.99)

Two sample t test

>t.test(a,b, var.equal=TRUE, paired=FALSE, alternative ="lesser",conf.level=0.90)

This t-test is for homogeneous variances (var.equal = TRUE) and independent samples (paired = FALSE: you can omit this because the function works on independent samples by default) ,the alternative and the confidence interval are the same as one same t test.

For a paired t test

>t.test(a,b, paired=TRUE,,conf.level=0.99)

t test for unequal variances and equal variances.

For the unequal variance t test, the null hypothesis is that the two population means are the same but the two population variances may differ

For the equal variance t test, the null hypothesis is that the two population means and populatio n variances are the same .

The unequal variance t test is more useful when you think about it as a way to create a confidence interval. Your prime goal is not to ask whether two populations differ, but to quantify how far apart the two means are. The unequal variance t test reports a confidence interval for the difference between two means that is usable even if the standard deviations differ.

The homogenity can be tested using the F test and while conducting two sample t test , use the following code,

>var.test(a,b)

For example ,

 = c(175, 168, 168, 190, 156, 181, 182, 175, 174, 179)
b = c(185, 169, 173, 173, 188, 186, 175, 174, 179, 180)

var.test(a,b)

     F test to compare two variances

data: a and b
F = 2.1028, num df = 9, denom df = 9, p-value = 0.2834
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
   0.5223017 8.4657950

Here the p value > 0.05,we accept H0 and hence the variances are assumed to be equal .


Related Solutions

Since hypertension can often be asymptomatic, (1) what are some effective methods that can be utilized...
Since hypertension can often be asymptomatic, (1) what are some effective methods that can be utilized to help us identify it early, and (2) what are the risk factors that we need to look for, and (3) what are some of the main barriers to patient compliance with pharmacological therapy? What can we do to help improve compliance?
A University Library has many items available for its students; some can be checked out and...
A University Library has many items available for its students; some can be checked out and others cannot. Among those that can be checked out are journal (i.e., a literary journal) and digital video disk (i.e., a DVD). These two types have many attributes in common such as title, publisher, and dewey decimal classification. Design a class to represent the library item that would capture the common features among journals and DVDs. Then, design journal and digital video classes that...
14.5     What are the major pitfalls a supervisor can fall victim to when carrying out disciplinary...
14.5     What are the major pitfalls a supervisor can fall victim to when carrying out disciplinary functions? 14.6     What does it mean to be fair when disciplining employees? 14.7     Why should you know yourself and your employees well before attempting to discipline or punish them?
What are the different commands in R software to analyze the Mayo clinic's "pbc" dataset?
What are the different commands in R software to analyze the Mayo clinic's "pbc" dataset?
What is cost forecasting and how is it utilized in project management? What are some methods...
What is cost forecasting and how is it utilized in project management? What are some methods and how is it calculated?
the act of carrying out the planned interventions
the act of carrying out the planned interventions
a) Observe the following Linux commands and work out what each command does: 1) $ ls...
a) Observe the following Linux commands and work out what each command does: 1) $ ls –al 2) $ /etc/profile 3) $ chmod 200 final_assignment.txt b) Consider a scenario where Bob has downloaded his messages to the local machine with an access of POP3, he can create mail folders and move the downloaded messages into the folders. Bob can then delete messages, move messages across folders, and search for messages (by sender name or subject). But this paradigm—namely, folders and...
(a) Discuss the procedure in carrying out the Johannes Cointegration. (b) Discuss how one can undertake...
(a) Discuss the procedure in carrying out the Johannes Cointegration. (b) Discuss how one can undertake the Eagle Granger error regression model. (c) In empirical research heteroskedacity is not a nusance because it offers a research to re-estimate the model. Discuss
What are the waste removal/ disposal methods that can be utilized in this process industry
What are the waste removal/ disposal methods that can be utilized in this process industry
What are 3 sympathomimetic drugs that can be utilized in the COPD exacerbated patient?
What are 3 sympathomimetic drugs that can be utilized in the COPD exacerbated patient?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT