You are on page 1of 11

Identiability Problem

Page 1 of 11

Identiability Problem
1 Introduction
This handout should be read in tandem with the Masterclass slides on Moodle. The main thrust of this section of 323MSE is to ll in the missing mathematics from these slides (with the aid of Maple) and to produce relevant Matlab simulations. The topic under consideration is known as Identiability and, given that this is Activity Led Learning, you should feel free to go off on a tangent within this topic area if you so wish. I suggest that students email me regularly (individually or as part of a group) suggesting any areas that you would like me to expand upon in the lecture part of the sessions. I will endeavour to meet most, if not all, such requests. This is your module so take an active part in how it develops.

2 The Masterclass Model


'$'$'$

&%&%&% e

r r

r r

Suppose, for the sake of example, that Compartment 1 in this diagram represents a patients blood, Compartment 2 represents the patients soft tissue and

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem Compartment 3 represents the patients bone.

Page 2 of 11

Now, suppose an amount of some drug is injected into the patients bloodstream and ows from there into soft tissue (represented by the arrow). From there, the drug either ows into the bone (and remains there) or ows elsewhere (and does not return), eventually being eliminated through sweat, urination etc. As a simple model, assume all the ows represented by the arrows have rates that are directly proportional to the amount of drug in the compartment from which the ow originates. The constants of proportionality are referred to as rate constants. Let xi (t) represent the amount of drug in compartment i at time t and use k ij for the rate constant corresponding to the ow from compartment i to compartment j. We denote the rate constant out of the system from compartment 2 as k2e (in the literature e here refers to environment). This gives rise to the following modied picture.

'

' rr

' rr

k12 x1 (t) x1 ( t )
& %

k23 x2 (t) x2 ( t )
%

x3 ( t )
%

&

&

k 2e x 2 ( t )
e e

The corresponding system of differential equations are: dx1 (t) = k12 x1 (t) dt dx2 (t) = k12 x1 (t) k23 x2 (t) k2e x2 (t) dt dx3 (t) = k23 x2 (t) dt

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 3 of 11

Since, the drug is initially injected into the bloodstream, we take x2 (0) = x3 (0) = 0. Let us choose units so that the amount of drug injected is one unit and hence x 1 ( 0 ) = 1. Finally, we shall assume that only x3 (t) will be measured. In practice, measurements will be discrete and noisy but, for the sake of identiability analysis, we shall assume we measure x3 (t) for all t 0 noise-free. It is standard to use y(t) for any measurement, so we have y ( t ) = x3 ( t )

3 Task 1 (Simulation)
Write the model in the vector-matrix form (t) = Ax(t) x y(t) = Cx(t) with x(0) = x0

Here the 3 3 matrix A will have entries that depend on the ow rates, C is a known 1 3 matrix and x0 is a known vector. This is a special case of a linear state-space model, which has the form (t) = Ax(t) + Bu(t) x y(t) = Cx(t) + Du(t) with x(0) = x0

where A (n n), B (n m), C ( p n) and D ( p m) are matrices. In our model, we shall take u(t) 0 and so B is irrelevant. Also, we have p = 1 ( p is the number of measurements) and so we write y(t) instead of y(t). Also, D is irrelevant (1 1 here). Create a script m-le in Matlab that rst assigns values for the three rate constants. Use k12 to store the value for k12 etc. Use your own values but they should all, of course, be positive (but not necessarily whole numbers). Next enter the matrices A and C and the initial state x0 (into variables A, C and x0 say). When entering A use the variables k12 etc rather than your chosen numerical

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 4 of 11

values. This is so that if you decide to edit the values for your rate constants you will only need to edit the rst line. Next, create a state space model in Matlab. Lets call this ssm. Since B to D are irrelevant, let us set these both to be zero. In the case of B, this would be a 3 1 zero matrix. In your Matlab script m-le, enter the command ssm = ss(A,zeros(3,1),C,0); Now simulate your model using the Matlab command (also in your m-le) [y t x] = initial(ssm,x0); Finally, using a 2 2 array of subplots, plot the three states against time. Note that t will be an N 1 column vector containing the N time points of the simulation. Similarly, x will be an N 3 matrix with the ith column being the corresponding values for the ith state. Label and title each plot suitably. (y is the output so this will be just a copy of the last column of x here.) Once you have done this, enter the command data = [t y]; to create an N 2 matrix, where the rst column is a time vector and the second column gives the corresponding values of the (ideal) measurement, y = x3 (t). The idea is that you will now give this data to a friend (doing the module) and will receive similar data also from a friend (not necessarily the same onearrange this amongst yourselves). Once you have received a set of data, the question becomes: can you nd what values of k12 , k23 and k2e where used to create these data? If not, can you nd all the different possible sets of rate constants that t? To do this, you will rst need to save the data using save data data

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 5 of 11

(this save the matrix data into a le called data.mat in a special Matlab format). Next, email this to your chosen friend as an attachment. Once you have received this attachment, save the le in the folder you are using for your Matlab work and the command load data will then load the data into the Matlab workspace.

4 Task 2 (Parameter Estimation)


The idea is as follows. First you make a guess for the rate constants. Next, you nd the corresponding values for y(t), for the t values in the data, and compare these with the actual y(t) values. You need to construct a measure for the error and a sensible way of doing this is to use the norm of the difference (using Matlabs norm command). The idea is to now iterate your guess values in such a way as to reduce the norm value as far as possible. When the error norm is zero, your corresponding y(t) values exactly match the actual values but a small error would be acceptable. In order to do this, you need to use fminsearch. To do this task, you need to construct a second script m-le. Begin this le by loading the data using load data (Note: If you could not arrange for somebody to send you an appropriate data le, use your ownat least for the time being.) Next, construct a vector containing your initial guess for the three rate constants: k12 , k23 and k2e . Since you have no real idea what these are (other than that they are positive), you may as well use 1 1 1 . k0 = [1 1 1];

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 6 of 11

Now add the following command but note that if you now try to run the m-le you will get an error message since Matlab will not know what myfun refers to. k = fminsearch(@(k) myfun(k,data), k0); disp(k_{12} = k(1)) disp(k_{23} = k(2)) disp(k_{2e} = k(3)) The rst of the above commands needs some explanation. The idea is that myfun.m is a function m-le (which you will need to construct), which has two inputs, k and data (a row vector and the data matrix) and one real-valued output. The output is the measure of how well the ow rates in the input vector, k, t the data as given in the data matrix, data (using the norm measure as suggested above, for example). The programme fminsearch then starts with k = k0 and then searches for a k which minimises the measure of t. Once found, it outputs this vector. The @(k) part of the command tells fminsearch to only adjust the values in k and not those in data. Your next task is therefore to write a function m-le myfun.m (you can, of course, change the name but you must then also change it in the above fminsearch command). The idea is that (in the function m-le) you should rst create t and y vectors from the columns of data (which it knows about, since this is one its inputs as mentioned above). Next, you construct the state space model that corresponds with k12 , k23 and k2e as stored in its other input k. Then you simulate this using initial as before but this time you cannot let Matlab choose the simulation timesthey must match those given in the t vector. Also, you must not use y for the output since this is being used already. Finally, as above, you need to construct the measure of t between your simulated output values and the actual output values in y. It may turn out that your nal estimated values do not match the actual ones (which your friend who supplied the data knows but you dont). Do not worry about this.

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem This will be analysed in what is to follow.

Page 7 of 11

5 Task 3 (Identiability Analysis)


Let us refer to the system, with rate constants k ij as estimated in Task 2, as Model 1. Now let us suppose we can nd another system, with rate constants rij say, that gives the same measurements from the same initial values. We shall refer to this system as Model 2. For this second model, we shall use zi (t) to refer to the amount of drug in compartment i at time t.

'

' rr

' rr

r12 z1 (t) z1 ( t )
& %

r23 z2 (t) z2 ( t )
%

z3 ( t )
%

&

&

r 2e z 2 ( t )
e e

Since the initial set-up is the same, we have z1 (0) = 1 and z2 (0) = z3 (0) = 0. Also, since the measurements are going to be the same, we also have y ( t ) = x3 ( t ) = z3 ( t ). First, write Model 2 in the state space form z (t) = Az(t) y(t) = Cz(t) where x0 and C should be as before. with z(0) = x0

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 8 of 11

It can be shown (see class for further details) that there must be a nonsingular matrix, T, for which z(t) = Tx(t). It can also be shown that any such T must be given by solving CT = C, Tx0 = x0 and TA = AT A trivial solution to this is T = I. This is of no interest, since it just gives z(t) = x(t) with rij = k ij . You should solve the above equations for a nontrivial T and, using the third equation, you should be able to get the constants rij in terms of k ij . (The solution is given in the Masterclass slides.) This analysis should be done for general rate constants k ij , not for xed values. Repeat your calculations using Maple (see below for some Maple commands you may (or may not) nd useful). Do this in such a way that it can easily be generalised to a more complicated model such as the Real Model from the slides. Finally, once you have estimated k ij and found any other candidate rate constants rij ask the friend who supplied the data to tell you what rate constants he or she used. Hopefully, one of your sets, k ij or rij , should match.

5.1 Some Maple Commands


(The following were written using the Classic Maple Worksheet.) You can input a matrix, column by column, using a command such as > A:=<1,2,3|4,5,6|7,8,9>; You can enter a general matrix using a command such as > T:=Matrix(3,3,symbol=t); You can produce a set of equations, such as those given the equation CT = C, by rst entering C and also T (as above) and then entering commands such as

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem > eq1:=C.T-C; > eq1:=convert(eq1,set);

Page 9 of 11

(Note that eq1 contains expressions rather than equations. This is ok since when we ask Maple to solve a set of expressions, it interprets this as meaning all expressions are set equal to zero.) Having constructed sets of equations for CT = C, can combine them using a union of sets. > eqs:=eq1 union eq2 union eq3; Next, we want to solve to get rij (and tij ) in terms of k ij . So, we want to construct a set containing all the rij and tij . One way of doing this is to use: > vars:=indets(Abar) union indets(T); where Abar represents the matrix A. Finally, we want to solve our equations for our variables. We can do this using > sol:=solve(eqs,vars); This gives two solution sets, one of which is the trivial solution where T = I and rij = k ij . Since the T matrix is largely irrelevant, we can concentrate on the rate constants, rij , by entering commands such as: > r1:=subs(sol[1],[r12,r23,r2e]); > r2:=subs(sol[2],[r12,r23,r2e]); Tx0 = x0 and TA = AT, you

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 10 of 11

6 Task 4 (Real Model)


The idea is that you now generalise Tasks 1 to 3 for the Real Model as given in the MasterClass slides (see Moodle). (t) = Ax(t) x y(t) = Cx(t) with x(0) = x0

where we have x (0) = 1 and v(0) = w(0) = y(0) = z(0) = 0. Also y(t) = y1 (t) y2 (t) . So A is 5 5 and C is 2 5. The two measurements are y1 (t) = x (t) and y2 (t) = w(t). Note that you will need to consider ways of producing a suitable real-valued measure of t given that you now have two outputs not one. Also, the data matrix should now have three columns, t, y1 (t) and y2 (t). Note also that you are unlikely to be able to run the Maple commands for general rate constants, k ij and so you are advised to use the model with the estimated rate constant values as your starting point. Given the complexity of this model, it is certainly possible that Maple may fail to nd the other possible rate constants and, even if it does, it may turn out that none of your possible sets matches those that your friend used to generate the data. Dont worry about this. It just goes to illustrate that real problems can be very hard to solve. The main thing is to do sensible calculations and, if possible, comment on why you think things didnt work out.

7 Concluding Comments
The report for this part of the module is due in by 18/04/13. This is likely to be a combination of group and individual work and so you must make it clear which work is your own and which was done as part of a group (listing the group members). Additionally, some of your work should involve looking at textbooks, journal papers and/or websites. If so, make sure you cite and reference correctly. If you do not, then

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex

Identiability Problem

Page 11 of 11

you will be guilty of plagiarism. At level 3, the penalty for this can be severe. Although a large part of the marking scheme will relate to Tasks 1 to 4, as above, there will be marks awarded for looking into other interesting avenues within the general areas of identiability and parameter estimation.

Mathematics - Dr Mike Chapman, February 4, 2013

Outline.tex