Question

In: Statistics and Probability

Using the Iris dataset in R; PLEASE CREATE YOUR OWN FUNCTION USING FORMULAS INTEAD OF FUNCTIONS...

Using the Iris dataset in R;

PLEASE CREATE YOUR OWN FUNCTION USING FORMULAS INTEAD OF FUNCTIONS THAT ARE BUILT IN R ,,,,,PLEASE TRY PLEASE

a Carry out a hypothesis to test if the population sepal length mean is 6.2 at α = 0.05. Interpret your results.

b Carry out a hypothesis to test if the population sepal width mean is 4 at α = 0.05. Interpret your results.

c Carry out a hypothesis to test if the population sepal width mean is 3 for the Versicolor species at α = 0.05. Interpret your results. d Carry out a hypothesis to test if the population sepal length mean is 6 for the Setosa species at α = 0.05. Interpret your results. d Carry out a hypothesis to test if there is any statistical difference sepal lengths of the Setosa and Versicolor species at α = 0.05. Interpret your results. e Carry out a hypothesis to test if there is any statistical difference petal widths of the Versicolor and the Verginica species at α = 0.05. Interpret your results.

Solutions

Expert Solution

Solution:

R CODE and OUTPUT with INTERPRETATION

(a)

> x=iris$Sepal.Length;t.test(x,mu=6.2,alternative="two.sided",conf.level=0.95)

One Sample t-test

data: x
t = -5.2753, df = 149, p-value = 4.589e-07
alternative hypothesis: true mean is not equal to 6.2
95 percent confidence interval:
5.709732 5.976934
sample estimates:
mean of x
5.843333

CONCLUSION:

p-value is quite low indicating there is strong evidence to claim that the mean sepal length is not equal to 6.2.

(b)

> y=iris$Sepal.Width;t.test(y,mu=4,alternative="two.sided",conf.level=0.95)

One Sample t-test

data: y
t = -26.488, df = 149, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 4
95 percent confidence interval:
2.987010 3.127656
sample estimates:
mean of x
3.057333

CONCLUSION:

   p-value is quite low indicating there is strong evidence to claim that the mean sepal width is not equal to 4.

(c)

>z=iris$Sepal.Width[which(Species=="versicolor")];t.test(z,mu=3,alternative="two.sided",conf.level=0.95)

One Sample t-test

data: z
t = -5.1828, df = 49, p-value = 4.121e-06
alternative hypothesis: true mean is not equal to 3
95 percent confidence interval:
2.68082 2.85918
sample estimates:
mean of x
2.77

CONCLUSION:

   p-value is quite low indicating there is strong evidence to claim that the mean sepal width for versicolor species is not equal to 3.

(d)

>w1=iris$Sepal.Length[which(Species=="setosa")];t.test(w1,mu=6,alternative="two.sided",conf.level=0.95)

One Sample t-test

data: w1
t = -19.94, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 6
95 percent confidence interval:
4.905824 5.106176
sample estimates:
mean of x
5.006

CONCLUSION:

p-value is quite low indicating there is strong evidence to claim that the mean sepal length for setosa is not equal to 6.

(e)

>w2=iris$Sepal.Length[which(Species=="versicolor")];t.test(w1,w2,mu=0,alternative="two.sided",conf.level=0.95)

Welch Two Sample t-test

data: w1 and w2
t = -10.521, df = 86.538, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.1057074 -0.7542926
sample estimates:
mean of x mean of y
5.006 5.936

CONCLUSION:

  p-value is quite low indicating there is strong evidence to claim that there is significant difference between sepal length of versicolor and setosa.

(f)

> u1=iris$Petal.Width[which(Species=="versicolor")];u2=iris$Petal.Width[which(Species=="virginica")]
> t.test(u1,u2,mu=0,alternative="two.sided",conf.level=0.95)

Welch Two Sample t-test

data: u1 and u2
t = -14.625, df = 89.043, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.7951002 -0.6048998
sample estimates:
mean of x mean of y
1.326 2.026

CONCLUSION:

p-value is quite low indicating there is strong evidence to claim that there is significant difference between petal width of versicolor and virginica.

Please give upvote.

Thank you.


Related Solutions

Using R Question 3. kNN Classification 3.1 Read in iris dataset using “data(iris)”. Describe the features...
Using R Question 3. kNN Classification 3.1 Read in iris dataset using “data(iris)”. Describe the features in the data using summary 3.2 Randomize the iris data set, mix it up and normalize it 3.3 split data into training & testing (70/30 split) 3.4 Train model in data and use crosstable function to evaluate the results 3.5 Rerun your code for K=10 and 100. Compare results and explain
1. Use the R command X <- iris to assign Fishers’ iris dataset to the data...
1. Use the R command X <- iris to assign Fishers’ iris dataset to the data matrix X. Using the head(X) command summarize what each column of the dataset is measuring and represents. Assign Y as a new matrix of dimension 150 by 4 which has the values of X without the species label. 2. Compute and interpret (in summary English) each of the summary statistics X,S,R using R. 3. Visualize the dataset by making a scatterplot of Sepal Length...
Using the Vehicle Ratings Excel file, create formulas using nested IF, AND, and OR functions to...
Using the Vehicle Ratings Excel file, create formulas using nested IF, AND, and OR functions to implement the three rating schemes described on the spreadsheet. Rating 1 If the vehicle has A/C and a sunroof or it is newer than 2013, then YES, otherwise NO. Rating 2 If the vehicle is Red and does not have high miles, then YES, otherwise if it is a Ford or Chevy, MAYBE, otherwise NO. Rating 3 If the vehicle is older than 2013...
, Excel allows us to create our own formulas and functions to perform calculations and solve...
, Excel allows us to create our own formulas and functions to perform calculations and solve problems within the spreadsheet. Which of the functions or formulas that you experimented with in Presentation 1 did you find the most valuable? How do you think this particular function will save time in using Excel spreadsheets? What other functions do you think you will use on a regular basis? Why? Explain. Was there a function that is new to you?
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing the level in feet of Lake Huron from 1872- 1972. To assign the values into an ordinary vector,x, we can do the following 'x <- as.vector(LakeHuron)'. From there, we can access the data easily. Assume the values in X are a random sample from a normal population with distribution X. Also assume the X has an unknown mean and unknown standard deviation. With this...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can be found on Canvas). Now fit a simple linear regression model with X = lotSize and Y = workHrs. Summarize the output from the model: the least square estimators, their standard errors, and corresponding p-values. b. Draw the scatterplot of Y versus X and add the least squares line to the scatterplot. c. Obtain the fitted values ˆyi and residuals ei . Print the...
Write your own R-function for the linear regression using qr() function. You must not use solve()...
Write your own R-function for the linear regression using qr() function. You must not use solve() function. The input of your function would be a design matrix X and a response vector y and the output must contain - least sqaure estimates and the corresponding stnadard errors. - residuals and MSE - fitted values - ANOVA table
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and use a function named highest() that takes three inputs and returns the highest number. After you have got it working, try calling the function with inputs ‘hat’, ‘cat’, ‘rat’.
Would you please demonstrate to me how to create dataset A and dataset B, where dataset...
Would you please demonstrate to me how to create dataset A and dataset B, where dataset A has a larger range but smaller standard deviation than dataset B. Then the reverse where data set A has a smaller range and larger standard deviation than data set B.
R.A.T.-Create Your Own Water Park Apply your knowledge of polynomial functions to create a water park,...
R.A.T.-Create Your Own Water Park Apply your knowledge of polynomial functions to create a water park, with 6 waterslides - one for under 6 years old (highest point at least 5m above ground) two for ages 6 to 12 (highest point at least 10m above ground) three for over age 12 (highest point at least 20 m above ground) A Create a polynomial equation for each waterslide. Show all of your work. The waterslide must begin at the y axis...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT