Question: Question 1 test a function which returns the standard error of the mean and the coefficient of variation for any numerical vector. The return value
Question 1
- test a function which returns the standard error of the mean and the coefficient of variation for any numerical vector. The return value should be a vector which contains the required values, with each value given an appropriate name. (Hint: if the last command in your function is a names() command, only the names will be returned.) Remember to annotate (comment) your function.
In a study of a large species of noctuid moth, the wing lengths in millimeters of 5 males (62, 64, 71, 59, 66) and 5 females (58, 62, 54, 61, 51) were measured.
- a vector called winglength.mm which contains all ten values, males first.
- a vector called sex which contains 5 consecutive 'M' and 5 'F' (corresponding to the first 5 measurements in winglength.mm being from male moths and the second 5 measurements being from female moths)
- Test your function using this data set. try to complete this for all data combined, plus individually for males and females
7.2Question 2
Sometimes you may encounter data that are presented as a frequency table. Below is a frequency table showing the number of repairs of a particular type required each year by 92 processing machines in a factory. Calculate the mean, variance and standard deviation of the number of repairs per machine.
Hint: In these situations in order to calculate summary statistics, we must reconstruct the data from the table. This requires using therep()function to generate a vector (in this case) that includes 64 records of zero, 16 records of 1 and so on.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
