Download presentation
Presentation is loading. Please wait.
1
Selected Statistics Examples from Lectures
2
Matlab: Histograms >> y = [ ]’; >> mean(y) ans = >> var(y) ans = >> std(y) ans = >> hist(y,9) histogram plot with 9 bins >> n = hist(y,9) store result in vector n >> x = [ ]’ >> n = hist(y,x) create histogram with bin centers specified by vector x
3
Probability Examples Probability that at least one coin will turn heads up from five tossed coins Number of outcomes: 25 = 32 Probability of each outcome: 1/32 Probability of no heads: P(AC) = 1/32 Probability at least one head: P(A) = 1-P(AC) = 31/32 Probability of getting an odd number or a number less than 4 from a single dice toss Probability of odd number: P(A) = 3/6 Probability of number less than 4: P(B) = 3/6 Probability of both: Probability of either: complement set
4
Permutation Examples Process for manufacturing polymer thin films
Compute the probability that the first 6 films will be too thin and the next 4 films will be too thick if the thickness is a random variable with the mean equal to the desired thickness n1 = 6, n2 = 4 Probability Encryption cipher Letters arranged in five-letter words: n = 26, k = 5 Total number of different words: nk = 265 = 11,881,376 Total number of different words containing each letter no more than once:
5
Combination Examples Effect of repetitions
Three letters a, b, c taken two at a time (n = 3, k = 2) Combinations without repetition Combinations with repetitions 500 thin films taken 5 at a time Combinations without repetitions
6
Matlab: Permutations and Combinations
>> perms([2 4 6]) all possible permutations of 2, 4, 6 >> randperm(6) returns one possible permutation of 1-6 >> nchoosek(5,4) number of combinations of 5 things taken 4 at a time without repetitions ans = 5 >> nchoosek(2:2:10,4) all possible combinations of 2, 4, 6, 8, 10 taken 4 at a time without repetitions
7
Continuous Distribution Example
Probability density function Cumulative distribution function Probability of events
8
Matlab: Normal Distribution
Normal distribution: normpdf(x,mu,sigma) normpdf(8,10,2) ans = normpdf(9,10,2) ans = normpdf(8,10,4) ans = Normal cumulative distribution: normcdf(x,mu,sigma) normcdf(8,10,2) ans = normcdf(12,10,2) ans = Inverse normal cumulative distribution: norminv(p,mu,sigma) norminv([ ],10,2) ans = Random number from normal distribution: normrnd(mu,sigma,v) normrnd(10,2,[1 5]) ans =
9
Matlab: Normal Distribution Example
The temperature of a bioreactor follows a normal distribution with an average temperature of 30oC and a standard deviation of 1oC. What percentage of the reactor operating time will the temperature be within +/-0.5oC of the average? Calculate probability at 29.5oC and 30.5oC, then calculate the difference: p=normcdf([ ],30,1) p = [ ] p(2) – p(1) 0.3829 The reactor temperature will be within +/- 0.5oC of the average ~38% of the operating time
10
Discrete Distribution Example
Matlab function: unicdf(x,n), >> x = (0:6); >> y = unidcdf(x,6); >> stairs(x,y)
11
Poisson Distribution Example
Probability of a defective thin polymer film p = 0.01 What is the probability of more than 2 defects in a lot of 100 samples? Binomial distribution: m = np = (100)(0.01) = 1 Since p <<1, can use Poisson distribution to approximate the solution.
12
Matlab: Maximum Likelihood
In a chemical vapor deposition process to make a solar cell, there is an 87% probability that a sufficient amount of silicon will be deposited in each cell. Estimate the maximum likelihood of success in 5000 cells. s = binornd(n,p) – randomly generate the number of positive outcomes given n trials each with probability p of success s = binornd(5000,0.87) s=4338 phat = binofit(s,n) – returns the maximum likelihood estimate given s successful outcomes in n trials phat = binofit(s,5000) phat =
13
Mean Confidence Interval Example
Measurements of polymer molecular weight (scaled by 10-5) Confidence interval
14
Variance Confidence Interval Example
Measurements of polymer molecular weight (scaled by 10-5) Confidence interval
15
Matlab: Confidence Intervals
>> [muhat,sigmahat,muci,sigmaci] = normfit(data,alpha) data: vector or matrix of data alpha: confidence level = 1-alpha muhat: estimated mean sigmahat: estimated standard deviation muci: confidence interval on the mean sigmaci: confidence interval on the standard deviation >> [muhat,sigmahat,muci,sigmaci] = normfit([ ],0.05) muhat = sigmahat = muci = 1.3079 sigmaci = 0.1273
16
Mean Hypothesis Test Example
Measurements of polymer molecular weight Hypothesis: m0 = 1.3 instead of the alternative m1 < m0 Significance level: a = 0.10 Degrees of freedom: m = 9 Critical value Sample t Reject hypothesis
17
Polymerization Reactor Control
Monomers Catalysts Solvent Hydrogen On-line measurements Lab Polymer Monomer Content Viscosity Lab measurements Viscosity and monomer content of polymer every four hours Three monomer content measurements: 23%, 18%, 22% Mean content control Expected mean and known variance: m0 = 20%, s2 = 1 Control limits: Sample mean: 21% process is in control
18
Goodness of Fit Example
Maximum likelihood estimates
19
Goodness of Fit Example cont.
20
Matlab: Goodness of Fit Example
Find maximum likelihood estimates for µ and σ of a normal distribution with function mle >> data=[320 … 360]; >> phat = mle(data) phat = Analyze dataset for goodness of fit using function chi2gof – usage: [h,p,stats]=chi2gof(x,’edges’,edges) for data in vector x divided into intervals with the specified edges If h = 1, reject hypothesis at 5% significance If h = 0, accept hypothesis at 5% significance p: probability of observing given statistic stats: includes chi-square statistic and degrees of freedom >> [h,p,stats]=chi2gof(data,’edges’,[-inf,325:10:405,inf]); >> h = 0 >> p = >> chi2stat = >> df = 7
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.