### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Computing and Data Analysis for Environmental Applications 1.017 / 1.010

Massachusetts Institute of Technology (MIT)

GPA 4.5

### View Full Document

## About this Document

## 30

## 0

## Popular in Computing and Data Analysis for Environmental Applications

## Popular in Civil and Environmental Engineering (CEE)

This 15 page Study Guide was uploaded by Kolade Abobarin on Wednesday July 27, 2016. The Study Guide belongs to 1.017 / 1.010 at Massachusetts Institute of Technology (MIT) taught by Prof. Dennis McLaughlin in Summer 2016. Since its upload, it has received 30 views. For similar materials see Computing and Data Analysis for Environmental Applications in Civil and Environmental Engineering (CEE) at Massachusetts Institute of Technology (MIT).

## Similar to 1.017 / 1.010 at Massachusetts Institute of Technology (MIT)

## Reviews for Computing and Data Analysis for Environmental Applications

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 07/27/16

1.017/1.010 Class 4 Joint Probability, Independence, Repeated Trials Joint Probabilities and Independence Joint probability of 2 events A and B defined in the same sample space (probability that outcome lies in A and B): P(AB) = P(C) ; where event C = AI B= AB If A and B are independent then: P(AB) = P(A)P(B) Note that mutually exclusive events are not independent since if one occurs we know the other has not. Example: Consider the following events A and B defined from a die toss experiment with outcomes {1, 2, 3, 4, 5, 6} A = {2, 4 ,6} B = {1, 2 ,3, 4} Then: P(A) = 1/2 , P(B) = 2/3, P(AB) = 2/6 = P(A)P(B) So A and B are independent. Composite experiments Related experiments are often conducted in a sequence. For example, suppose we toss a fair coin (with 2 equally likely outcomes {H T}) and then throw a fair die (with 6 equally likely outcomes {1, 2, 3, 4, 5, 6}). This process can be viewed as two separate experiments E a1d E wi2h different sample spaces. Or … it can be viewed as a single composite experiment E (with 12 ordered equally likely outcomes { H1, H2, H3, H4, H5, H6, T1, T2, T3, T4, T5, T6 }. 1 Events defined in E 1and E h2ve equivalent events in E. Example: A 2 { 2, 3 } in E2corresponds to A = { H2, H3, T2, T3 } in E. A particular ordered sequence of events from E and E1also ha2 an equivalent event in E : Example: A 1 {H} in E t1en A ={22 3} in E cor2esponds to A = { H2, H3 } in E. Suppose that A is the composite experiment event that corresponds to event A 1 from experiment E an1 then event A from 2xperiment in E . 2 A1 and A 2re independent if: P E(A) = PE1A )1 (E2) 2 The subscript on each probability identifies the corresponding experiment and sample space. The events A a1d A def2ned in the above coin toss/die roll example satisfy the independence requirement. Repeated trials Repeated identical experiments are called repeated trials. Example: Consider a composite experiment composed of 3 successive fair coin tosses. 3 This experiment can yield 2 = 8 equally likely ordered outcomes: {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT} The probability of the event A = {exactly 2 heads in 3 tosses} is the fraction of total number of outcomes that yield exactly 2 heads: P(A) = 3/8 Now consider a particular composite experiment event: A 1= {H} then A 2{H} then A ={3} 2 Suppose the repeated trials are independent. Then the probability of this composite event is: P( A 1then A 2hen A )3= P(A )P(1 )P( 2 ) = (3/2)(1/2)(1/2) = 1/8. This is one of 3 mutually exclusive repeated trial event sequences that yield exactly 2 heads. It follows that the probability of exactly 2 heads is 3(1/8) = 3/8. Since this is equal to the probability obtained from the composite experiment the independence assumption is confirmed. Copyright 2003 Massachusetts Institute of Technology Last modified Oct. 8, 2003 3 1.017/1.010 Class 5 Combinatorial Methods for Deriving Probabilities Deriving Probabilities The basic idea of the conceptual/deductive approach for deriving probabilities is to break the composite experiment into parts (sub- experiments). These parts are selected so that events for each part have readily identified probabilities (e.g. they are equally likely). The rules of probability can then be used to derive the probability of complex events for the composite experiment. The approach is usually applied to problems with a finite number of discrete outcomes. The simplest application is an experiment that divides into a number of sub- experiments with independent equally likely outcomes. In this case, suppose A is the event of interest and S is the sample space. Then the probability of A is the ratio of the number of outcomes N(A) in A to the total number of outcomes N(S): N(A) P(A) = N(S) Types of Experiments To evaluate numbers of outcomes and probabilities we need to distinguish different kinds of experiments: Sampling with replacement: Observed sub-experiment outcomes can reoccur in subsequent trials vs Sampling without replacement: Observed sub-experiment outcomes cannot reoccur in subsequent trials Sub-experiment outcomes are ordered vs. Sub-experiment outcomes are not ordered Product Rule Many combinatorial methods rely on the counting or product rule, which relates total experimental outcomes to sub-experiment outcomes: 1 If an experiment is divided into k successive sub-experiments and sub-experiment i yields n oitcomes, the total number of possible outcomes for the experiment is the product n n ..1 2 k Permutations and Combinations When experiments involve selecting k items from a group of n and order matters we often need to compute number of permutations: P = n(n −1)(n− 2)...(n− k +1) = n! k,n (n− k)! When outcomes involve selecting k items from a group of n and order does not matter we often need to compute number of combinations: C = P / P = n! k,n k,n 1,k k!(n − k)! Examples Consider following letters written on 4 cards: A, a, B, C. Experiment consists of 2 successive random draws from S. We wish to know probability of getting an A in one draw and a B in the other. With replacement (cards are replaced after they are drawn): If Event = E = {AB, aB} (order matters in event definition, B must be obtained on draw 2): N(S) =(4)(4)=16 ; 4 outcomes possible on each draw, product rule Consider {A, a} to be a group with 2 elements. Acceptable number of outcomes from this group on Draw 1 is P 1,2= 2 (either A or a). Acceptable number of ways group outcome can be allocated is P1,1= 1 (Draw 1 only). N(E) = (P )1,2 )=1,1)(1) = 2 P(E)=1/8 If Event = E = {AB, aB, BA, Ba} = (order does not matter in event definition): N(S) = (4)(4)=16 Acceptable number of ways outcome from group {A, a} can be allocated is P 1,2 2 (Draws 1 or 2) 2 N(E) = (P 1,2( P1,2 (2)(2) = 4 P(E) = 1/4 Without replacement (cards are not replaced after they are drawn): If Event = E = {AB, aB} (order matters in event definition, B must be obtained on Draw 2): N(S) = P 2,4= (4)(3) = 12 ; 4 outcomes possible on Draw 1, 3 outcomes possible on Draw 2 Acceptable number of outcomes from group {a, A} on Draw 1 is P 1,2 = 2. Acceptable number of ways group outcome can be allocated is P1,1= 1 (Draw 1 only) N(E) = (P 1,2P )1,1(2)(1) = 2 P(E)=1/6 If Event = E = {AB, aB, BA, Ba} = (order does not matter in event defn): N(S) = P2,4= (4)(3) =12 3 Acceptable number of ways outcome from group {A, a} can be allocated is P 2,2= 2 (Draws 1 or 2) N(E) = (P 1,2 )2,2(2)(2) = 4 P(E) = 1/3 When sampling with replacement where order does not matter N(S) and N(E) may be redefined so only combinations rather than permutations are distinguished. Tree can be redrawn accordingly. In above example this gives: N(S) = C 2,4= 6 N(E) = (C )(C ) = (2)(1) = 2 1,2 2,2 P(E) = 1/3 Also see combinatorial examples For complex combinatorial problems it is useful to check results with virtual experiments. See example MATLAB code balls.m. Copyright 2003 Massachusetts Institute of Technology Last modified Oct. 8, 2003 4 1.017/1.010 Class 6 Conditional Probability and Bayes Theorem Conditional Probability If two events A and B are not independent we can gain information about P(A) if we know that an event in B has occurred. This is reflected in conditional probability of A given B, written as P(A|B): P(AB) P(A| B) = P(B) The unconditional probability P(A) is often called the a priori probability while the conditional probability P(A|B) is often called the a posteriori probability. Note that conditioning may take place in either direction: P(AB) = P(A|B)P(B) = P(B|A)P(A) Conditional probabilities are valid probability measures that satisfy all the fundamental axioms. If A and B are independent: P(A|B) = P(A) Example: A = {Algae bloom occurs } B = {Daily average water temperature above 25 deg. C) Obtain probabilities from long record of daily algae and temperature observations: Suppose P(A) = 0.01, P(B) = 0.15, P(A, B) = 0.005 Then: P( | ) = P (B ) = 0.005= 0.033 P( ) 0.15 Probability of a bloom increases significantly if we know that temperature is above 25 deg. C. Bayes Theorem 1 Suppose that the sample space S is divided into a collection of n mutually exclusive events (sets) called a partition of S: S ={A ,1 ,A2,..3,A } n A i =j0 i ≠ j Consider an arbitrary event B in S, as indicated in the diagram below: The event B can be written as the union of the n disjoint (mutually exclusive) events BA , 1A , .2., BA : n B = BA + BA + ... + BA 1 2 n This implies total probability theorem: P(B) = P(B|A )1(A ) 1 P(B|A )P(A2) + .2. + P(B|A )P(A )n n The total probability theorem and the definition of the conditional probability may be used to derive Bayes theorem: P(B | A iP(A ) i P(B | A iP(A ) i P(A |iB) = = P(B) P(B | A 1P(A )(1) ...+P(B+| A )P(A )n n Bayes rule updates P(A),igiven information on the probabilities of obtaining B when outcomes are A , A , .1., 2 . n Example: Consider a group of 10 water samples. Exactly 3 are contaminated. Define following events: Event Definition C Sample contaminated C ' Sample not contaminated 2 D Contamination detected D ' Contamination not detected P(C) = 0.3 (based on 3 out of 10 samples contaminated) Suppose sample analysis technique is imperfect. Based on calibration tests: P(D|C ) = 0.9 Successful detection P(D|C' ) = 0.4 False alarm Bayes theorem (replace A w1th C, A w2th C′, B with D ): P( | ) ( ) (0.9)(0.3) P ( | ) = = = 0.5 P( | ) ( )+ P D ( | C ) ( ′) (0.9)(0.3) (0.4)(0.7) Copyright 2003 Massachusetts Institute of Technology Last modified Oct. 8, 2003 3 1.017/1.010 Class 7 Random Variables and Probability Distributions Random Variables A random variable is a function (or rule) x( ξ) that associates a real number x with each outcome ξ in the sample space S of an experiment. Assignment of such rules enables us to quantify a wide range of real-world experimental outcomes. Example: Experiment: Toss of a coin Outcome: Heads or tails Random Variable: x(ξ) = 1 if outcome is heads, x(ξ) = 0 if outcome is tails Event: x( ξ) greater than 0 Probability Distributions Random variables are characterized/defined by their probability distributions. Cumulative distribution function (CDF) Consider events: x(ξ) less than x : A ={x(ξ) ≤ x} x(ξ) lies in the interval lx,ux B ={x l x(ξ) ≤ x }u For any random variable x . . . the cumulative distribution function (CDF) gives the probability that x( ξ) is less than a specified value x: F xx) = P[ ( ) ≤ x] = P(A) The probability that x(ξ) is greater than x: P[x(ξ) > x] =1− F (x) x The probability that x(ξ) lies in interval [x, x ] is: l u P[x l< x ( ) x u = F xx u F (xx) l = P(B) Example: Discrete uniform CDF 1 Fx(x) = 0.0 x < 0 Fx(x) = 0.3 0 < x ≤ 1 Fx(x) = 0.7 1 < x ≤ 2 Fx(x) = 1.0 x > 2 Example: Continuous uniform CDF Fx(x) = 0.4x 0 < x ≤ 2.5, 0 otherwise Probability mass function (PMF) For a discrete x with possible outcomes x …x , PM1 is Nrobability of x: i − px(x i = P[x(ξ) = x ]i= F (x )−iF (x x i The probability that x(ξ) lies in the interval [x, l ]uis: P x l < (ξ) ≤ xu] = ∑ px(x)i= P(B) x < x ≤ x l i u Example: Discrete uniform PMF: px(0) = 0.3 px(1) = 0.4 px(2) = 0.3 Probability density function (PDF) For a continuous x . . . PDF is derivative of CDF: f x ) = dF x( ) x dx The probability that x(ξ) lies in the interval [x, xl] us: x u P[x < x ( ) x ] = f (x)dx = P(B) l u ∫ x x l Example: Continuous uniform PDF fx(x) = .4 0 < x ≤ 2.5, 0 otherwise 2 Exercise: Constructing probability distributions from virtual experiments Consider a sequence of 4 repeated independent trials, each with the outcome 0 or 1. Suppose that P(0) = 0.3 and P(1) = 0.7. Define the discrete random variable x = sum of the 4 trial outcomes (varies from 0 to 4). 4 There are 2 =16 possible experimental outcomes, each giving a particular value of x. In some cases, several different outcomes give the same value of x (e.g. C 1,4= 4 outcomes give x = 1). This experiment yields a binomial probability distribution. Plot the PMF and CDF of x, using the rules of probability to evaluate F (x) x and p (x) ior x =i0, 1, 2, 3, 4. Duplicate these results with a virtual experiment that generates many sequences of 4 trials each. Derive F (x) and px(x) by evalxating the fraction of replicates that yield x = 0, 1, 2, 3, 4. i Generalize your pencil and paper analysis to give a general expression for px(xi when there are 100 rather than 4 repeated independent trials and x i = 0, 1, 2, 3, … 100. Plot the CDF and PDF. Confirm your results with a virtual experiment. Copyright 2003 Massachusetts Institute of Technology Last modified Oct. 8, 2003 3 1.017/1.010 Class 8 Expectation, Functions of a Random Variable Mean, variance of random variables Expectation (population mean) of x... E[x] For a discrete x: E(x) = x = x p (x ) ∑ i x i For a continuous x: +∞ E(x) = x = ∫xfx(x)dx −∞ (Population) variance of x... Var[x]: 2 Var(x) = E x - x ] Derive these for uniform & triangular distributions Functions of a random variable y = g(x) x is a random variable with CDF F (x) x y is a random variable with CDF F (yy since it depends on x Derived distribution problems Derive F (y) from F (x) using either of these options: 1. Analytical derivation Apply definitions of y, x (x), and y (y). F yy) = P[y ≤ y] = P[g(x) ≤ y] = P[x ={x | g(x) ≤ y}] 2. Stochastic simulation Generate many realizations of x, compute y for each replicate, construct empirical F yy) from y replicates Example (analytical derivation): Distribution of y = x for a uniformly distributed x: Uniform distribution centered on 0: 1 y= g ( )= x 2 x+1 Fx( ) = ; fx( ) =1 ; −1≤ x ≤1 2 Fy( ) = [y ≤ ] = [ (x) ≤ ] = [x ={ | ( ) ≤ ]x y F ( ) = [x ={ |x x 2≤ ] = [− y0.5≤ x ≤ y0.] =F y( 0.)− F (−y0.) = y0.5 ; 0 ≤ y ≤1 y x x Uniform distribution centered on 0.5 (note need to split y interval into 2 parts): 2 y= g x = x F x ) = x +1)/3 ; f (x) =1/3 ; −1≤ x≤ 2 x x Fyy ) = Py ≤ ]y= [P g) ≤ ] =y[x P{ | ( )x g x y 2 0.5 0.5 0.5 0.5 2y 0.5 Fyy ) = Px ={ |x x ≤ ]y= [P y ≤ x ≤ y ] =F x( )− F x(−y ) = ; 0 ≤ y ≤1 3 = Px ={ | x x 2≤ y = [P1≤ x ≤ y0.] = F y 0.)− F (−1) = y 0.+1)/3 ; 1≤ y ≤ 4 x x Mean and variance of y = g(x) : E(y) = E[g(x)] = ∑ g(x ip xx i i +∞ E(y) = E[g(y)] = g(x) fx(x)dx ∫ −∞ 2 Var(y) =Var[g(y)] = E [g(x) - g(x)] } Copyright 2003 Massachusetts Institute of Technology Last modified Oct. 8, 2003 2

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.