Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

R Programming This Week's Questions involve the Fibonacci sequence, which is the series of numbers: 1, 1, 2,3, 5,8, 13, 21,34, . . ., where,

R Programming

image text in transcribedimage text in transcribed
This Week's Questions involve the Fibonacci sequence, which is the series of numbers: 1, 1, 2,3, 5,8, 13, 21,34, . . ., where, if we denote by fk the kth number in this sequence, then fie : flail + fki2, fOI k 2 3- Your tasks are: 1. Create a function called f-i bo . seq , which satisfies the following properties: 0 It has two arguments: one called n (with no default value), and one called full (with default value set to TRUE). 0 What the function returns depends on whether the user sets argument full to TRUE or FALSE. - If fu11=TRUE , then the function returns on one line (as a vector) the first to numbers in the Fibonacci sequence (starting at 1, 1,. . .). If fu11=FALSE , then the function returns the nth number (only) of the Fibonacci sequence. (You can assume that the argument n entered by a user is bigger or equal to 3.) 2. Consider a discrete random variable X such that Pr[X: fk] :pk fork : 1,2,...,n, where fk corresponds to the kth number in the Fibonacci sequence and {191,192, . . . ,pn} is a sequence of probabilities such that 22:11)), : 1. Create a function called f-i bo.moments , which satisfies the following properties: a It has two arguments: one called n (with no default value), one called probas (with no default value). Again you can assume that n 2 3. I It returns a vector of two values: the first is the expected value lE[X] and the second is the standard deviation ofX (under the assumption that the argument probas is a vector containing 131,132, . . . ,1)\Hint: You can call a function (e.g. f-i b0 . seq ) within another function. A precision to avoid any possible ambiguity (added 22/06/2021 )2 Because f1 : f2 : 1, we have that PF[X = 1] =p1 + 132. 3. Run the command rat'io

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algebra And Trigonometry Enhanced With Graphing Utilities (Subscription)

Authors: Michael, Michael Sullivan III, Michael III Sullivan, Michael Sullivan 111, III Sullivan

6th Edition

0321849132, 9780321849137

More Books

Students also viewed these Mathematics questions

Question

Methods of Delivery Guidelines for

Answered: 1 week ago