Propagation of Error Ch En 475 Unit Operations Quantifying variables (i.e. answering a question with a number) 1. Directly measure the variable. - referred to as “measured” variable ex. Temperature measured with thermocouple 2. Calculate variable from “measured” or “tabulated” variables - referred to as “calculated” variable ex. Flow rate m = r A v (measured or tabulated) Each has some error or uncertainty Uncertainty of Calculated Variable Calculate variable from multiple input (measured, tabulated, …) variables (i.e. m = rAv) What is the uncertainty of your “calculated” value? Each input variable has its own error Example: You take measurements of r, A, v to determine m = rAv. What is the range of m and its associated uncertainty? Details provided in Applied Engineering Statistics, Chapters 8 and 14, R.M. Bethea and R.R. Rhinehart, 1991). To obtain uncertainty of “calculated” variable • DO NOT just calculate variable for each set of data and then average and take standard deviation • DO calculate uncertainty using error from input variables: use uncertainty for “calculated” variables and error for input variables Plan: Obtain max error (d) for each input variable then obtain uncertainty of calculated variable Method 1: Method 2: Method 3: Method 4: Propagation of max error - brute force Propagation of max error - analytical Propagation of variance - analytical Propagation of variance - brute force – Monte Carlo simulation Value and Uncertainty • Value used to make decisions - need to know uncertainty of value • Potential ethical and societal impact • How do you determine the uncertainty of the value? Sources of uncertainty (from Rhinehart, Applied Engineering Statistics, 1991): 1. Estimation - we guess! 2. Discrimination - device accuracy (single data point) 3. Calibration - may not be exact (error of curve fit) 4. Technique - i.e. measure ID rather than OD 5. Constants and data - not always exact! 6. Noise - which reading do we take? 7. Model and equations - i.e. ideal gas law vs. real gas 8. Humans - transposing, … Estimates of Error (d) for input variables (d’s are propagated to find uncertainty) 1. Measured: measure multiple times; obtain s; d ≈ 2.5s Reason: 99% of data is within ± 2.5s Example: s = 2.3 ºC for thermocouple, d = 5.8 ºC 2. Tabulated : d ≈ 2.5 times last reported significant digit (with 1) Reason: Assumes last digit is ± 2.5 (± 0 assumes perfect, ± 5 assumes next left digit is fuzzy) Example: r = 1.3 g/ml at 0º C, d = 0.25 g/ml Example: People = 127,000 d = 2500 people Estimates of Error (d) for input variables 3. Manufacturer spec or calibration accuracy: use given spec or accuracy data Example: Pump spec is ± 1 ml/min, d = 1 ml/min 4. Variable from regression (i.e. calibration curve): d ≈ 2.5*standard error (std error is stdev of residual) Example: Velocity is slope with std error = 2 m/s 5. Judgment for a variable: use judgment for d Example: Read pressure to ± 1 psi, d = 1 psi Estimate of Error for Calculated Variables (i.e., Propagation of Error) A. Max error: 1. propagating error with brute force 2. propagating error analytically B. Probable error: 1. propagating variance analytically 2. propagating variance with brute force (i.e., Monte Carlo) Example Problem Data from a computer show that the flow rate is 562 ml/min ± 3 ml/min (stdev of computer noise). Your calibration shows 510 ml/min ± 8 ml/min (stdev). What flow rate do you use and what is d? In the following propagation methods, it’s assumed that there is no bias in the values used - let’s assume this for all lab projects. Method 1: Propagation of max error- brute force Brute force method: obtain upper and lower limits of all input variables (from maximum errors); plug into equation to get uncertainty of calculated variable (y). Uncertainty of y is between ymin and ymax. This method works for both symmetry and asymmetry in errors (i.e. 10 psi + 3 psi or - 2 psi) Example: Propagation of max error- brute force 𝑚= rAv r = 2.0 A = 3.4 cm2 v = 2 cm/s g/cm3 Brute force method: min (table) (measured avg) (slope of graph) max r A Additional information: sA = 0.03 cm2 std. error (v) = 0.05 cm/s v All combinations What is d for each input variable? 𝑚 min < 𝑚 < 𝑚 max Example: Propagation of max error- brute force 𝑚= rAv Compute d (look at cheat sheet) r = 2.0 g/cm3 (table) A = 3.4 cm2 (measured avg) v = 2 cm/s (slope of graph) Additional information: sA = 0.03 cm2 std. error (v) = 0.05 cm/s What is d for each input variable? 2.5 lowest digit = 0.25 2.5 sA = 0.075 2.5 std. error (v) = 0.125 Example: Propagation of max error- brute force 𝑚= rAv r = 2.0 A = 3.4 cm2 v = 2 cm/s g/cm3 Brute force method: (table) (measured avg) (slope of graph) min max r 1.75 2.25 A 3.325 3.475 v 1.875 2.125 Additional information: sA = 0.03 cm2 std. error (v) = 0.05 cm/s All combinations What is d for each input variable? 𝑚 min < 𝑚 < 𝑚 max 10.9 16.6 13.6 2.69 3.01 Method 2: Propagation of max error- analytical Propagation of error: Utilizes maximum error of input variable (d) to estimate uncertainty range of calculated variable (y) Uncertainty of y: y = yavg ± dy dy i y di xi * Remember to take the absolute value!! Assumptions: • input errors are symmetric • input errors are independent of each other • equation is linear (works o.k. for non-linear equations if input errors are relatively small) Example: Propagation of max error- analytical 𝑚= r A v y x1 x2 x3 dy i r = 2.0 A = 3.4 cm2 v = 2 cm/s g/cm3 y di xi dm m m m dr dA dv r A v Av (table) (measured avg) (slope of graph) 3.42 rv 2 2 rA 2 3.4 m = mavg ± dm = rAv ± dm = 13.6 ± 2.85 g/s Remember from above: For r, s r = 0.1 g/cm3 dr 0.25 sA = 0.03 cm2, dA 0.075 std. error (v) = 0.05 cm/s dv 0.125 ferror,r m dr r dm (fractional error) = (3.4)(2)(0.25) = 0.60 (2.85) Propagation of max error • If linear equation, symmetric errors, and input errors are independent brute force and analytical are same • If non-linear equation, symmetric errors, and input errors are independent brute force and analytical are close if errors are small. If large errors (i.e. >10% or more than order of magnitude), brute force is more accurate. • Must use brute force if errors are dependent on each other and/or asymmetric. • Analytical method is easier to assess if lots of inputs. Also gives info on % contribution from each error. Method 3: Propagation of variance- analytical 1. Maximum error can be calculated from max errors of input variables as shown previously: a) Brute force b) Analytical 2. Probable error is more realistic • Errors are independent (some may be “+” and some “-”). Not all will be in same direction. • Errors are not always at their largest value. • Thus, propagate variance rather than max error • You need variance (s2) of each input to propagate variance. If s (stdev) is unknown, estimate s = d/2.5 Method 3: Propagation of variance- analytical y 2 s xi xi s y2 i 2 y = yavg ± 1.96 SQRT(s2y) 95% y = yavg ± 2.57 SQRT(s2y) 99% • gives propagated variance of y or (stdev)2 • gives probable error of y and associated confidence • error should be <10% (linear approximation) • use propagation of max error if not much data, use propagation of variance if lots of data Example: Propagation of variance Calculate r and its 95% probable error M r L(D 2 / 4) All independent variables were measured multiple times (Rule 1); averages and s are given M = 5.0 kg L = 0.75 m D = 0.14 m s = 0.05 kg s = 0.01 m s = 0.005 m Propagation of Variance Example Problem r M D2 L 4 M av 5 Lav 0.75 Dav 0.14 s M 0.05 s L 0.01 s D 0.005 dM 2.5 s M dL 2.5 s L dD 2.5 s D 4 dr Propagation of errors: Lav Dav rav 4 M av Lav Dav 2 433.075 2 dM M av 4 2 Dav Lav dr 102.597 2 s r dL dr 2.5 8 M av Lav Dav 3 dD 41.039 uncertainty 1.96 s r 80.436 Method 4: Monte Carlo Simulation (propagation of variance – brute force) • Choose N (N is very large, e.g. 100,000) random ±δi from a normal distribution of standard deviation σi for each variable and add to the mean to obtain N values with errors: x ' x d i i i – rnorm(N,μ,σ) in Mathcad generates N random numbers from a normal distribution with mean μ and std dev σ • Find N values of the calculated variable using the generated x’i values. • Determine mean and standard deviation of the N calculated variables. Monte Carlo Example 1 Example Problem r M 2 D L 4 M av 5 Lav 0.75 Dav 0.14 s M 0.05 s L 0.01 s D 0.005 dM 2.5 s M dL 2.5 s L dD 2.5 s D Monte Carlo M trial rnorm N , M av , s M Ltrial rnorm N , Lav , s L 4 M trial 434.738 rav mean 2 Ltrial Dtrial Dtrial rnorm N , Dav , s D 4 M trial 32.091 s r stdev 2 Ltrial Dtrial uncertainty 1.96 s r 62.899 Monte Carlo Simulation Example 2 • Estimate the uncertainty in the critical compressibility factor of a fluid if Tc = 514 ± 2 K, Pc = 61.37 ± 0.6 bar, and Vc = 0.168 ± 0.002 m3/kmol? Overall Summary A. Measured variables: (use all) 1. Average 2. Std dev (data range) 3. Confidence interval from student t-test (mean range and mean comparison) B. Calculated variable: determine uncertainty (pick one) 1. Max error: propagating error with brute force 2. Max error: propagating error analytically 3. Probable error: propagating variance analytically 4. Probable error: propagating variance with brute force (i.e., Monte Carlo) Data and Statistical Expectations (for UO Lab reports) 1. 2. 3. 4. Summary of raw data (table format) Sample calculations– including statistical calculations Summary of all calculations- table format is helpful If measured variable: average and standard deviation for all, confidence of mean for at least one variable 5. If calculated variable: 1 of the 4 methods. Please state in report. If messy equation, you may show 1 of 4 methods for small part and then just average (with std dev.) the value (although not the best method).