Question
R Programming: Use preexisting functions in R to write a function called ourhist that produces a pro- portion histogram of a numerical vector x such
R Programming:
-
Use preexisting functions in R to write a function called ourhist that produces a pro- portion histogram of a numerical vector x such that the number of breaks is determined by the Scott method and the histogram is overlaid with the density line. Test it on 100 randomly generated observations from the Exp(3) distribution.
-
Without using the ifelse() function, write a function that adds 1 to all the positive entries of a vector and subtracts one from all the non-positive entries. Test it on 100 randomly generated observations from the N(0,1) distribution, and use the function from the previous problem to create a histogram of the modified sample.
-
Write the same function as in the previous problem, only this time use the ifelse()function.
-
The classic Fibonacci sequence is defined such that the first two numbers are 0 and 1, and each subsequent number in the sequence is the sum of the two numbers preceding it. I.e.,
a1 = 0 a2 = 1 ak = ak1 + ak2.
Its easy to see that the first nine numbers in the sequence are 0,1,1,2,3,5,8,13,21,.... Write a recursive function that returns the nth Fibonnacci number.
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