Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the intrinsic R functions sd() and mean() to define a CV() function. Give your function the default parameter name=coefficient of variation, and provide for
- Use the intrinsic R functions sd() and mean() to define a CV() function. Give your function the default parameter name="coefficient of variation", and provide for ellipsis parameters. Test your function against data with a known outcome, e.g simulated exponential data
CV(rexp(1000, rate=2), name="is this value close to 1.0?")
- Test the function with a canned dataset, e.g.LakeHuron or sunspot.month. Use the name parameter to label each estimate with a meaningful name (Use the R ? help feature to get descriptions.)
Put It to Work
Compare the CV's for two uniform random samples, runif(1000, min=0, max=1) and runif(1000, min=0, max=10). Are they markedly different? If so, how?
Compare the CV's for two Gaussian random samples rnorm(1000, mean=10, sd=2) and rnorm(1000, mean=5, sd=2). Are they markedly different? If so, how?
Compare the CV's for two gamma random samples, rgamma(1000, shape=3, rate=1) and rgamma(1000, shape=6, rate=1). Are they markedly different? If so, how?
Knit it up, convert to PDF, and send it in.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started