
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

22S:166 Fall 2007Instructor: Cowles
Homework 4
See reading assignment under Web Resources on course web page.Problems (due Fri. 9/28):1. In R, use the
help.search
function to locate a package that contains a
function to compute the skewness of a vector of numbers.
What is the
name of the function, and which package is it in?
of numbers.
What is the name of the function, and which package is it
in?
(a) Accepts one argument: a vector(b) Checks whether the vector is numeric(c) If not, displays the message “Vector must be numeric” and exits(d) If yes, computes the skewness of the values (after removing any miss-
ing values)
i. if the absolute value of skewness is less than 1, returns a list
containing two objects:A. skewness in an object named “skewness”B. a vector consisting of the mean and standard deviation in an
object named “descstats”
ii. otherwise, returns a list containing two objects
A. skewness in an object named “skewness”B. a vector consisting of the five-number summaryin an object
named “descstats”
ments:(a) c(”Arthur”, ”Mary”, ”Rover”)(b) rnorm( 100 )(c) rexp( 100, 5) Submit your homework electronically through ICON by Fri. 9/28. Include a text file with all your R code, as well as a PDF file that has
mydesc( rexp(100,5) )$skewness[1] 1.462030$descstats[1] 0.000019662 0.057816812 0.105732124 0.265288314 0.