Presentation is loading. Please wait.

Presentation is loading. Please wait.

Matlab: Statistics Probability distributions Hypothesis tests

Similar presentations


Presentation on theme: "Matlab: Statistics Probability distributions Hypothesis tests"— Presentation transcript:

1 Matlab: Statistics Probability distributions Hypothesis tests
Response surface modeling Design of experiments

2 Statistics Toolbox Capabilities
Descriptive statistics Statistical visualization Probability distributions Hypothesis tests Linear models Nonlinear models Multivariate statistics Statistical process control Design of experiments Hidden Markov models

3 Probability Distributions
21 continuous distributions for data analysis Includes normal distribution 6 continuous distributions for statistics Includes chi-square and t distributions 8 discrete distributions Includes binomial and Poisson distributions Each distribution has functions for: pdf — Probability density function cdf — Cumulative distribution function inv — Inverse cumulative distribution functionsstat — Distribution statistics function fit — Distribution fitting function like — Negative log-likelihood function rnd — Random number generator

4 Normal Distribution Functions
normpdf – probability distribution function normcdf – cumulative distribution function norminv – inverse cumulative distribution function normstat – mean and variance normfit – parameter estimates and confidence intervals for normally distributed data normlike – negative log-likelihood for maximum likelihood estimation normrnd – random numbers from normal distribution

5 Hypothesis Tests 17 hypothesis tests available
chi2gof – chi-square goodness-of-fit test. Tests if a sample comes from a specified distribution, against the alternative that it does not come from that distribution. ttest – one-sample or paired-sample t-test. Tests if a sample comes from a normal distribution with unknown variance and a specified mean, against the alternative that it does not have that mean. vartest – one-sample chi-square variance test. Tests if a sample comes from a normal distribution with specified variance, against the alternative that it comes from a normal distribution with a different variance.

6 Mean Hypothesis Test Example
>> h = ttest(data,m,alpha,tail) data: vector or matrix of data m: expected mean alpha: significance level Tail = ‘left’ (left handed alternative), ‘right’ (right handed alternative) or ‘both’ (two-sided alternative) h = 1 (reject hypothesis) or 0 (accept hypothesis) Measurements of polymer molecular weight Hypothesis: m0 = 1.3 instead of m1 < m0 >> h = ttest(x,1.3,0.1,'left') h = 1

7 Variance Hypothesis Test Example
>> h = vartest(data,v,alpha,tail) data: vector or matrix of data v: expected variance alpha: significance level Tail = ‘left’ (left handed alternative), ‘right’ (right handed alternative) or ‘both’ (two-sided alternative) h = 1 (reject hypothesis) or 0 (accept hypothesis) Hypothesis: s2 = and not a different variance >> h = vartest(x,0.0049,0.1,'both') h = 0

8 Goodness of Fit Perform hypothesis test to determine if data comes from a normal distribution Usage: [h,p,stats]=chi2gof(x,’edges’,edges) x: data vector edges: data divided into intervals with the specified edges h = 1, reject hypothesis at 5% significance h = 0, accept hypothesis at 5% significance p: probability of observing the given statistic stats: includes chi-square statistic and degrees of freedom

9 Goodness of Fit Example
Find maximum likelihood estimates for µ and σ of a normal distribution >> data=[320 … 360]; >> phat = mle(data) phat = Test if data comes from a normal distribution >> [h,p,stats]=chi2gof(data,’edges’,[-inf,325:10:405,inf]); >> h = 0 >> p = >> chi2stat = >> df = 7

10 Response Surface Modeling
Develop linear and quadratic regression models from data Commonly termed response surface modeling Usage: rstool(x,y,model) x: vector or matrix of input values y: vector or matrix of output values model: ‘linear’ (constant and linear terms), ‘interaction’ (linear model plus interaction terms), ‘quadratic’ (interaction model plus quadratic terms), ‘pure quadratic’ (quadratic model minus interaction terms) Creates graphical user interface for model analysis

11 Response Surface Model Example
VLE data – liquid composition held constant >> x = [300 1; 275 1; 250 1; ; ; ; ; ; ]; >> y = [0.75; 0.77; 0.73; 0.81; 0.80; 0.76; 0.72; 0.74; 0.71]; Experiment 1 2 3 4 5 6 7 8 9 Temperature 300 275 250 Pressure 1.0 0.75 1.25 Vapor Composition 0.77 0.73 0.81 0.80 0.76 0.72 0.74 0.71

12 Response Surface Model Example cont.
>> rstool(x,y,'linear') >> beta = (bias) (T) (P) >> rstool(x,y,'interaction') >> beta2 = (bias) (T) (P) (T*P) >> rstool(x,y,'quadratic') >> beta3 = (bias) (T) (P) (T*P) (T*T) (P*P)

13 Design of Experiments Full factorial designs
Fractional factorial designs Response surface designs Central composite designs Box-Behnken designs D-optimal designs – minimize the volume of the confidence ellipsoid of the regression estimates of the linear model parameters

14 Full Factorial Designs
>> d = fullfact(L1,…,Lk) L1: number of levels for first factor Lk: number of levels for last (kth) factor d: design matrix >> d = ff2n(k) k: number of factors d: design matrix for two levels >> d = ff2n(3) d =

15 Fractional Factorial Designs
>> [d,conf] = fracfact(gen) gen: generator string for the design d: design matrix conf: cell array that describes the confounding pattern >> [x,conf] = fracfact('a b c abc') x =

16 Fractional Factorial Designs cont.
>> gen = fracfactgen(model,K,res) model: string containing terms that must be estimable in the design K: 2K total experiments in the design res: resolution of the design gen: generator string for use in fracfact >> gen = fracfactgen('a b c d e f g',4,4) gen = 'a' 'b' 'c' 'd' 'bcd' 'acd' 'abd'


Download ppt "Matlab: Statistics Probability distributions Hypothesis tests"

Similar presentations


Ads by Google