Statistics using R Studio
Question Description
#save your plots as an image file and upload separately
#save them as png with filename your_name_(question number)_(histogram/plot)
#write the commands, not just the numeric answer
#Question 1
#Create a new vector x with the following values:
# 2,2,3,3,3,4,4,4,10000000,10000000
#Then calculate:
#a. Mean and Median
#b. 10% trimmed mean and 20% winsorized mean.
#Question 2
#(a) Read in the homework file hw_lab2.txt and call the object hwdata. Please use the file name instead of file.choose() in the read function
mydata = read.table(‘hw_lab2.txt’, header=TRUE, sep=NULL)
#(b) How many variables are in the file? How many subjects?
#(c) Create a histogram of the fruit day variable. Will the mean of the data
#be to the left (lower) or right (higher) of the most frequent values?
#(d) Create a boxplot of the fruit day variable. How many outliers are present?
#HINT:
#1) boxplot(x)
#2) print(boxplot(x,plot=F)$out)
#(e) Find the mean, median, and trimmed mean (20%) of the fruit day variable.
#(f) Create a density plot of the fruit day variable.
# (g) Add vertical lines to the previous plot that show where the mean, median,
#and trimmed mean are located.