Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write your own functions in R to do the following: myAvg { compute average return average } mySD { compute Std Dev return Std Dev

Write your own functions in R to do the following:

myAvg

{ compute average return average }

mySD

{ compute Std Dev return Std Dev }

myRange

{ compute Range, calculated as Max - Min return Range }

Read the CardioGoodnessFit.csv file and apply these functions to the last two columns Income and Miles.

The output should look like the following:

Income (Average, SD, Range): 53719.58, 16506.68, 75019

Miles (Average, SD, Range): 103.19, 51.86, 339\

Please comment the portions in the enclosed boxes in the following program. Please make sure that you explain the meaning and relevance of all variables in the enclosed boxes.

image text in transcribed

## Stock prices # DAILY CLOSING PRICES NOV 1, 1993 TO APR 3, 2003 a11-read . table ( "prices. txt", header=TRUE) msft-all,2 ge-a11 [ , 4 ] n-length (msft) d_msft-rep (0, n) r msft-rep (0,n) d_ge-rep (0,n) r_ge-rep (0,n) for (t in 2:n) d ms ft [t]=msft [t]-msft[t-1] r_ms ft [t]-d-ms ft [t]/msft[t-1] | d ge [t]age [t]-ge [t-1] rge [t]=dge [t]/ge [t-1] - - par (mfrow=c (1,2) ) plot (r_msft, type-"1" main-"Daily Returns 11/1/1993 to 4/3/2003" xlab-"day", ylab-"Returns", col-"blue" hist(r msft, col-"blue" xlab-"Microsoft Returns" prob-T, nclass-20) id-ge= (d-ge>0) ftable(id ge,id msft

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_2

Step: 3

blur-text-image_3

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

Prove product rules (i), (iv), and (v).

Answered: 1 week ago

Question

3. Discuss the process of behavior modeling training.

Answered: 1 week ago