Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5.

Similar presentations


Presentation on theme: "Lecture 5."— Presentation transcript:

1 Lecture 5

2 Paper 1 Select an area of human endeavor (e.g., a particular sport, marketing, politics, car manufacturing …) and write a 5 page paper on how statistics influenced it. Due on Thursday 9/29. Make sure you clearly reference your sources (including websites)

3 Student’s presentations!
Yay

4 R Loops (functions, objects)

5 Issues Case sensitive dog and Dog are different
Careful of extra spaces Brackets ( ) arguments of functions sum(coin); for(i in 1:10), if(coin<1) grouping math formulas (1+3)*(4+5) vs 1+3*4 +5 [ ] indexing valus in a list coin[10] { } grouping commands togather

6 Fibonacci Fibonacci numbers
0, 1, 1, 2, 3, 5, 8, 13, … (explain) Write a loop that prints first 100 fibonacci numbers Idea: (wrap for loop around) New_Number <- Old_Number1 + Old_Number2 Old_Number2 <- Old_Number1 Old_Number1 <- New_Number

7 Homework Create a code that writes first 100 numbers of “super Fibonacci” sequence Xn = Xn-1+Xn-2+Xn-3, X1=X2=X3=1

8 Runs Q: Take guesses (closest will get a cookie)
Toss a coin times. Run is an unbroken sequence of H in a row What is the length of the longest run Take guesses (closest will get a cookie) We will write an R code together

9 Homework Repeat 1000 times and calculate the average run (out of the 1000)

10 Writing code Think of the logic (algorithm)
Then write in the programming language


Download ppt "Lecture 5."

Similar presentations


Ads by Google