matlab la intro 2015 rev1

Upload: timsyki

Post on 07-Jan-2016

227 views

Category:

Documents


0 download

DESCRIPTION

Linear Algebra in matlab

TRANSCRIPT

Absolute quantitative proteomics by IDMS: proof of principle

1

Linear AlgebraContentLinear regression for calibrationSimple linear regressionWeighted linear regressionError estimationMATLAB Solve the linear regressionMultidimensional case2Your future salary..Years of education, worth doing it?how much are you going to earn?3

Formulate a modelSalary (mostly) depends on educationSalary = a * x_education + b4Cannot explain single salaries, but a reasonable approximation

FormalismDependent / independent variables, parametersEducation?Salary?a, b?

How were a and b calculated?5Independent chosen = educationDependent = SalaryParameters = a, bMeasurement devices (GC, LC, spectophotometer, )A compound of interest produces a readout(External) calibration is used to quantify response (slope & offset)

6

Linear modelThe signal intensity (y) is a linear function of the concentration (x):

Measuring two different concentrations, a and b can be determined:7

Is that all?What about random noise (errors)?

Has a major impact on the slope and offset:

8

More points, repetitionsDetermine a and b from more measurements

Normal inverse does not work anymore

9Calculate the best estimateThe best solution for a and b is the one with minimal residuals between measurements and lineDefine a value for the deviations most commonly sum of squared errors10

Calculate minimumMathematical formulation

Solve? Determine minimum of the function SSQ -> derivative = 011

StatisticsOr.. How accurate are your results?12

Perfect measurements?What assumptions were implicitly made?Accuracy of the measurements? Each point had the same absolute error

Mostly, we assume observe a constant relative measurement error..

Or a mixture of both = heteroscedastic13

Weighing of the measurementsEach e has a normal distribution s

Define residuals normalized to the standard deviation

14

Weighted linear regressionSame procedure as previously15

Good luckApply linear algebraVector and Matrix formalismParameter vector (a and b)

Measurement vector y

Linear model:

16

continuedSum of squared errors (weighted)

17

SolutionDerivative18

Same asConstruct a vector & matrixStandard concentrations x = [ 0; 1; 2; 3; 5; 10; 20 ]Measurements y = [0.07; 5.30; 10.09;16.29;27.65; 54.97;96.46]19

MATLABConstruct matrix A

A = [ x, ones( size(x) ) ]

20

Calculate a & bab = (A'* A)^-1 * A' * y

a = ab(1)b = ab(2)21

VisualizationPlot the measurements & regression lineplot( x, y, sb ); hold onplot( [0; x(end)], [ b; x(end)*a+b ], r: )

22

But does not tell youconcentration +/- confidence / standard error

23Error in slope and offset prediction confidenceThe calibration line is based on errorprone measurementsThere is some uncertainty in a and b24

Weighted regressionMotivationMeasurement error is relative (weight = 1/x)Measurement error is known (repetitive measurements)25MATLABConstruct matrix A

A = [ x, ones( size(x) ) ]

Construct matrix S

S = diag( [0.5; 0.6; 0.7; 0.8; 1.0; 1.5; 2.5].^2 )26

Result weighted regressionDifferent calibration lineCloser to low concentrated observationsLess close for high concentrations 27

Different to:Error in a, b & prediction confidence28

MultidimensionalMore than one observable (y)More than 1 slope / offset29

Examples:Determine coefficients in chemical reactionsDetermine HP coefficients Black-Box modelStep 1: Define parameter vector 30

Step 2: Generate matrix A

CHONcharge3031

CHONchargeStep 3: Separate known (independent) and unknown (dependent

32Step 4: Solve

Herbert PirtDetermined Case 3 experiments

33StrainmuqSqP1/h-1mmol/g/hmmol/g/hS10.20844.99471.6525S20.15153.74471.4274S30.09572.4951.161234

Step 1: Define parameter vector

Step 2: Generate matrix A

35Step 3: Separate known (independent) and unknown (dependentAlready separated.. xf = qSStep 4: Solve

More experiments36StrainLac additionmuqSqPmM1/h-1mmol/g/hmmol/g/hS100.20844.99471.6525S200.15153.74471.4274S300.09572.4951.1612S1500.20985.01411.388S2500.15183.76241.2008S3500.09462.5110.9796S11500.19825.01411.0454S21500.1393.76190.9052Assume a, b independent of LAC

ms dependent of LAC37

Step 1: Define parameter vector

38

Step 2: Generate matrix A39Step 3: Separate known (independent) and unknown (dependentAlready separated.. xf = qSStep 4: Solve

Inverse cannot be calculated