Getting ready

You are given a vector of numeric values representing the number of hours spent on social media in a week as follows:

    13, 21, 19, 18, 21, 16, 21, 24, 17, 18, 12, 18, 29, 17, 18, 11, 13,   
20, 25, 18, 15, 19, 21, 21, 7, 12, 23, 31, 16, 19, 23, 15, 25, 19,
15, 25, 25, 16, 29, 15, 26, 29, 23, 24, 20, 19, 14, 27, 22, 26

The task is to calculate the mean, standard deviation, median, and MAD based on a value of another variable sym. If the value of the sym variable is classical, then you will calculate the mean and standard deviation. Alternatively if the value of sym is robust, then you will calculate the median and MAD. Also, you will implement this task using the switch function and if…else if…else. Once you have done the implementation, you will repeat the calculation a certain number of times, say 100,000 times, and then calculate the total time required.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset