Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAT 131 First Discussion Section

Plan

In this discussion session, we will complete two tasks: 1. Installing R and RStudio on your computer, and a few quick demonstration of using R through RStudio (We will go through more R operations next week.) 2. Review  some of the main math topics needed for the class.

Installing R

R is a free software environment for statistical computing and graphics from CRAN, the Comprehensive R Archive Network.

I highly recommend you install a precompiled binary distribution for your operating system use the links ps:  www.r-pro ec .org       ps:  www.r-pro ec .orghtt//jt/(htt//jt/) to download and install R.

Installing RStudio

RStudio is a widely used IDE (stands for integrated development environment) for R. It provides a powerful user interface for R. Get the Open Source Edition of RStudio Desktop from the link https://posit.co/downloads/ (https://posit.co/downloads/).

RStudio comes with a text editor, so there is no immediate need to install a separate stand-alone editor.

If you have a pre-existing installation of R and/or RStudio, we highly recommend that you reinstall both and get as current as possible. It can be considerably harder to run old software than new.

Math review

The math review is based on Appendix A from Blitzsten and Hwang.

Sets

A is a collection of objects. The objects can be anything: numbers, people, cats, event other sets. If S is a set, the notation x ∈ S indicates that x is an element of the set S, and x ∉ S indicate x is not in S. We say set A is a       subset of B if every element of A is also in B , denoted by A ⊆ B.

Can you give some example of sets?

We can use rules to describe sets. For example, what does {(x , y) R2  : x2  + y2 ≤ 1} represent?

The of two sets A and B , written as A U B, is the set of all objects that are in A or B (or both). The intersection of A and B , written as A ∩ B, is the set of objects that are in both A and B . We say A and B are disjoint if       A U B = ∅ . In many applications, we are interested in some set S and a set A ⊆ S . In this case we defi ne the complement of a set A to be all objects in S but not in A, denoted by Ac .

Functions

Let A and B be sets, a function from A to B is a deterministic rule that, given an element of A as input, provides an element of B as an output. A is called the domain and B is called the target. The notation f : A B says    that f is a function mapping A to B . The range of f is {y B : f (x) = y for some x A}. It is important to    distringuish f (the function) and f (x) (the value of the function when evaluated at x).

Can you give some examples of a continuous function from the real line to the real line?

Can you give some examples of continuous and increasing function from the real line to the real line?

Matrices

A matrix is a rectangular arry of numbers. We say that the dimension of a matrix are m by n if it has m rows and n columns. We write A = aij  to indicate that the row i column j entry of A is aij .

How do you add two matrices? e.g.,

( 34

How do you multiple two matrices?

23

5

( 4(2)

6(15) ) + ( 111

( 11

6(5) ) 5

2

2

2

1

3

3(5) )

Derivatives

Solve the following problems:

d log(x)

dx

d x

e

x2 e−x3

What is the maximum value of x2 ex3  ?

For f (x , y) = y log(x), fi nd    ∂x     and    ∂y    .

Integrals

Find 01 0y (x y)2 dxdy

Consider the polar coordinate expression of points on R2 . Let x = rcos(θ) , y = rsin(θ), where r is the

distance from (x , y) to the origin and θ ∈ [0 , 2π) is the angle. Find the area of the region x2  + y2  ≤ 1 using

∫ ∫   1dxdy

x2 +y2 ≤1

Solve the same problem by changing the variables from (x , y) to (r , θ).