Question

In: Statistics and Probability

Here is the R code for running a t-test: t.test( numeric vector of data values, another...

Here is the R code for running a t-test:

t.test( numeric vector of data values, another optional numeric vector of data values,

       alternative = c("two.sided", "less", "greater"),

       mu = Ho, paired = c(TRUE, FALSE), var.equal = c(TRUE,FALSE),conf.level =1-)


1.) Suppose 30 students are all taking the same Math 115 and English 101 classes at CSUN. You want to know in which class students tend to do better. The data below represents the class averages of the students in both classes. Write the R code that does the following:

a.) Makes two boxplots one green for the Eng_101 and a blue one for Math_115 labels the main title as "Class averages for students taking Stats vs English” and names the Eng_101 data as “English 101” and the Math_115 data as “Intro to Statistics”.

b.) Computes the sample size, mean and standard deviation of the Eng_101 and Math_115.

c.) Performs a paired two-sided t-test with =.01 to Eng_101 and Math_115 to decide whether there has been a statistically significant difference between the class averages in English 101 and Math 115.

d.) Paste your R code into Run R Script and run the script.

e.) Paste the R output to the bottom R code.

f.) Looking at the p-value in the R output, decide if there is evidence to suggest that there is a statistically significant difference between the class averages in English 101 and Math 115. Write the p-value and your conclusion at the top of your R code.

Eng_101<-c( 80, 72, 73, 76, 79, 79, 79, 75, 75, 68, 70, 76, 79, 74, 73, 81,72, 74, 77, 83, 79,78, 72, 79,60,54,50,40,65,59)

Math_115<-c( 74, 67, 74, 70, 76, 60,56,45,66,81, 67, 63, 71, 76, 66, 73, 77, 68, 71, 75,

68, 79, 73, 85, 78, 77, 72, 77, 59,65)

Solutions

Expert Solution

Conclusion: Here p-value= 0.5835 which greater than 5% level of significance, therefore we may fail to reject null hypothesis and conclude that there is insufficient evidence that there is significant difference between the class averages in English 101 and Math 115. ie., there is no significant difference between the class averages in English 101 and Math 115.

The respective r-codes are given below, you can also customize that that r-codes .

> Eng_101<-c( 80, 72, 73, 76, 79, 79, 79, 75, 75, 68, 70, 76, 79, 74, 73, 81,72, 74, 77, 83, 79,78, 72, 79,60,54,50,40,65,59)
> Math_115<-c( 74, 67, 74, 70, 76, 60,56,45,66,81, 67, 63, 71, 76, 66, 73, 77, 68, 71, 75,68,79,73,85,78,77,72,77,59,65)
> boxplot(dataframe,horizontal=FALSE,las=1,notch=FALSE,outline=TRUE,outcol="#512DA8",outpch=19, col=c("Green","Blue"),xlab="",ylab="", main="Class averages for students taking Stats vs English ",sub="",col.lab="#000000",col.main="#000000",col.sub="#000000",col.axis="#000000",cex.lab=1,cex.main=1,cex.sub=1,cex.axis=1)


> n1=length(Eng_101)
> n1
[1] 30
> n2=length(Math_115)
> n2
[1] 30
> m1=mean(Eng_101)
> m1
[1] 71.7
> m2=mean(Math_115)
> m2
[1] 70.3
> Sd1=sqrt(var(Eng_101))
> Sd1
[1] 9.986715
> Sd2=sqrt(var(Math_115))
> Sd2
[1] 8.225905
> Ttest=t.test(Eng_101,Math_115,paired=T,conf.level=0.95)
> Ttest

   Paired t-test

data: Eng_101 and Math_115
t = 0.55454, df = 29, p-value = 0.5835
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.763463 6.563463
sample estimates:
mean of the differences
1.4


Related Solutions

Here is the R code for running a t-test: t.test( numeric vector of data values, another...
Here is the R code for running a t-test: t.test( numeric vector of data values, another optional numeric vector of data values,        alternative = c("two.sided", "less", "greater"),        mu = Ho, paired = c(TRUE, FALSE), var.equal = c(TRUE,FALSE),conf.level =1-) 2) You want to determine if the average height of men in California is greater than the average height of men in Nebraska. You take a random sample of 30 men in California and 30 men in Nebraska. The data below represents...
Given a vector of numeric values. with a R function using loop. testdouble(data). that returns TRUE...
Given a vector of numeric values. with a R function using loop. testdouble(data). that returns TRUE if all the even indexs elements of the vector are twice their preceding value, other wise your function returns FALSE. You can assume that the given vector has an even number of values. TRUE scenarios: c(3, 6, 5, 10, 11, 22, 13, 26) c(0, 0,1, 2, 2, 4, 3, 6) FALSE scenarios: c(3, 7, 5, 6, 11, 22, 13, 26) c(0, 2, 1, 2,...
Using R code solve Here, we look at how t critical values behave as their df...
Using R code solve Here, we look at how t critical values behave as their df (degrees of freedom) increases: a. First, what is z.05? b. Second, if you look at t.05,df (t critical values for α = .05) with df = 20, 40, 60, etc (continuing up by 20 each time), for what df does the t critical value first fall strictly within (e.g. < ) i. .05 of z.05? ii. .02 of z.05? iii. .01 of z.05? c....
Numeric results for several independent samples t tests are presented here. Decide whether each test is...
Numeric results for several independent samples t tests are presented here. Decide whether each test is statistically significant, and report each result in the standard APA format. A total of 73 people were studied, 40 in one group and 33 in the other group. The test statistic was calculated as 2.13 for a two tailed test with a p level of .05 One group of 23 people was compared to another group of 18 people. The t statistic obtained for...
Data Analysis & Visualization Topic R vector and save the r code in a text file...
Data Analysis & Visualization Topic R vector and save the r code in a text file Problem 1. Create two vectors named v and w with the following contents:      v : 21,10,32,2,-3,4,5,6,7,4,-22      w : -18,72,11,-9,10,2,34,-5,18,9,2 A) Print the length of the vectors B) Print all elements of the vectors C) Print elements at indices 3 through 7. D) Print the sum of the elements in each vector. E) Find the mean of each vector. (Use R's mean() function)...
Data Structures for R studio Create a numeric vector containing 10 random numbers ranging from 1...
Data Structures for R studio Create a numeric vector containing 10 random numbers ranging from 1 to 10000. Validate that the object you created is a vector Give an example of where you might find this in a biologicall data set. Create a 10-member list containg both numeric and character data. Validate that the object you created is a list Give an example of where you might find this in a biologicall data set. Create a data frame that relates...
In R, Create a function that replaces the negative values in a numeric matrix with a...
In R, Create a function that replaces the negative values in a numeric matrix with a random integer between 1 and 10. At the same time, it counts the negative values and prints their number. Apply the function to a 4 by 5 matrix of random continuous uniform values ranging from -10 to 10.
What are the values you get from "data[,1]" and "data[,2]" in r code? Are the values...
What are the values you get from "data[,1]" and "data[,2]" in r code? Are the values from "data[,1]" are the fitted values/ yhat values? When I try "fitted(data)" I get different values from "data[,1]", I am very confused.
Write a function in R named counts. This function should take as parameters a numeric vector...
Write a function in R named counts. This function should take as parameters a numeric vector x and also a number indicating a number of bins n. The function will consider the range [min(x),max(x)], and then consider a parti- tion of this interval into n non-overlapping equally sized half open intervals: I1 = [min(x),b1),I2 = [b1,b − 2),...,In = (bn−1,max(x)]. Note that since the intervals are equally sized, the value of bi is constrained. The function will then return a...
Find the 95% confidence interval of the mean of a vector in r code. The vector...
Find the 95% confidence interval of the mean of a vector in r code. The vector length is 100.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT