Parameter Redundancy Workshop Maple Practical I First open the Maple worksheet MaplePartI.mw This worksheet contains procedures for determining whether models are parameter redundant or not. The first prompt allows the use of the linear algebra package in Maple (which allows the matrix algebra required in parameter redundancy analysis). Press <enter> to start the linear algebra package. > The second prompt is the procedure for forming a derivative matrix of any vector, kappa, with respect to any vector of parameters, pars. Press <enter> to activate the procedure. > The third prompt is the procedure converting a matrix to a vector of all its non-zero entries. Again press <enter> to activate the procedure. > The next two prompts are procedures for finding the solutions to TD = 0, and the estimable set of parameters respectively. Again press <enter> to activate each of these procedures. > > The last procedure ringmod(x,y,z,r,c) finds the probability matrix for different types of ringrecovery models (again press enter). Example 1a: CJS Model We shall start by examining the CJS model with 3 years of marking and 3 years of recovery. The parameters in this model are 1 2 3 p2 p3 p4 , where i is the probability of surviving year i and pi is the probability of being first recaptured in year i. The probabilities of being marked in year i and first recaptured in year j are given by the matrix 1 p 2 1 p 2 2 p3 1 p 2 2 p33 p 4 P 0 2 p3 2 p33 p 4 p 2 1 p 2 etc 0 0 3 p 4 In this example it is obvious that the last survival parameter is confounded with the last reporting probability (as 3p4 are only ever seen as a product). We shall demonstrate how to use Maple and symbolic algebra to confirm this parameter redundancy. First we enter the parameters in vector form and the probabilities of being first recaptured as a matrix. One way to input a matrix or vector is using the brackets ‘< >’ and ‘|’ to separate row entries and ‘,’ to separate column entries. At the next prompt enter the vector of parameters; use the code below and press <enter>. > Then enter the matrix of probabilities. It is not necessary to go to the next line at the same point as in the code below. If you want to do this press <shift> and <enter> together. Pressing alone <enter> executes the command. The ‘’ means times and is entered using ‘*’. > Next we shall turn this Matrix of probabilities into a column vector, consisting of the matrix’s nonzero entries. This is done via the procedure Matvec. > We can now find the derivative matrix, using the procedure Dmat > The rank of the derivative matrix gives the number if estimable parameters in the model. The rank of the derivative matrix is found using the Maple command Rank. > The answer should be 5, which confirms that there are 5 estimable parameters in the CJS model. We can also find the deficiency, how many parameters cannot be estimated, using: > The answer should be 1. A model that has deficiency 0 is not parameter redundant and all the parameters in that model can be estimated. A model that has deficiency greater or equal to 1 is parameter redundant. As this model is parameter redundant we can find which parameters can be estimated by looking at the solution(s) to TD = 0. Here we use the procedure Findalpha. > The answer should be The zeros (in the order the parameters were entered) tell us the parameters we can estimate. Nonzeros tell us the parameters we cannot estimate. Here the first two zeros show that we can estimate 1 and 2. The second two zeros show that we can estimate p2 and p3. The two one-zero entries show that we can not estimate 3 or p4. To find out which parameter combinations are estimable we need to solve a set of partial differential equations. The procedure Estpars finds the set of estimable parameters > The solution, shows we can estimate 1, 2, p2, p3 and 3p4. Example 1b: CJS Model What happens if there are only 2 years of marking but 3 years of recovery in the CJS? How many parameters are estimable? Which parameter combinations are estimable? (Note that you can use <ctrl> <c> to copy and <ctrl <v> to paste to save typing P out again. Then the last row of P can be deleted.) ………………………………………………………………………………………………………. ………………………………………………………………………………………………………. Example 1c: CJS Model – time varying covariates What happens if we add time varying covariates, with i = {1+exp(a+bxi)}-1, to the CJS with 3 years of ringing and 3 years of recovery? Copy and paste P from example 1a, and enter the parameters: > > Then evaluate P at i = {1+exp(a+bxi)}-1 > How find the derivative matrix and it’s rank. Is this model full rank? ……………………………………………………………………………………………………. Example 2 a. Now consider a model for the recovery of dead animals, which were marked as young. Suppose the probability of surviving the first year of the animal’s life is time dependent, denoted by 1,i and that the probability of surviving for an adult animal is constant, denoted by a. The probability of reporting of dead animals depends on whether the animal is in its first year, 1, or is an adult, a. Suppose there have been two years of marking and three years of recovery. The parameters are 1,1 1, 2 a 1 a and the probabilities of recovery are 1,1 a a a P 1,1 1 1,1 a a 1, 2 1 1, 2 a a 0 Find the derivative matrix and its rank. Is this model parameter redundant? ………………………………………………………………………………………………………. ………………………………………………………………………………………………………. ………………………………………………………………………………………………………. b. Next consider the nested model where the probability of surviving the first year of life is not time dependent, so that 1,1 = 1,2 = 1. Which parameters can be estimated now? ………………………………………………………………………………………………………. ………………………………………………………………………………………………………. Example 3: Ring-recovery (T/A/T) – Extension theorem Now consider another ring recovery model, where first year survival is dependent on time, adult survival is dependent on age, and the reporting probability is dependent on time. The recapture probability matrix is: (1 1,1 )1 1,1 (1 2 )2 1,12 (1 3 )3 1,123 (1 4 )4 1,1234 (1 5 )5 0 (1 1, 2 )2 1, 2 (1 2 )3 1, 22 (1 3 )4 1, 223 (1 4 )5 P 0 0 (1 1,3 )3 1,3 (1 2 )4 1,32 (1 3 )5 0 0 0 (1 1, 4 )4 1, 4 (1 2 )5 To save typing out this matrix completely the procedure ringmod(x,y,z,r,c) finds the probability matrix for any rc recovery matrix which has the options: x/y/z. x refers to first year survival and can be either constant (x=1) or time dependent (x = 2). y refers to adult survival and can either be constant (y=1), time dependent (y=2), age dependent (y=3) or both age and time dependent (y=4). z refers to reporting probability and has the same options as y. The code we use here is: > > Find the derivative matrix and show this model is full rank. Now consider extending this model with an extra year of recapture. The model extends with extra 1,1 23 45 (1 6 )6 (1 ) 1, 2 2 3 4 5 6 terms: 2 and extra parameters: 2 = [6 6]. 1,3 23 (1 4 )6 1, 4 2 (1 3 )6 2, j Find the derivative matrix D2 and its rank. Is this extended model full rank or parameter 2,i redundant? …………………………………………………………………………………………… How can we generalise this result to any number of years of ringing and recovery? ……………………………………………………………………………………………………. Example 4: Ring-recovery Can you fill in the table below, finding the parameter redundancy for various ring-recovery models with r years of ringing and c years of recovery. The first one has been done for you and the code for this is given below. Model C/C/C C/C/C C/C/C r 2 2 r c 2 3 c C/T/C 2 2 C/T/C 2 3 C/T/C r c T/T/C 2 2 T/T/C 2 3 T/T/C r c T/T/T 2 2 T/T/T 2 3 T/T/T 3 3 T/T/T 3 4 T/T/T 4 4 T/T/T 5 5 T/T/T r c no. pars 3 3 3 rank 2 3 3 deficiency 1 0 0 > > > > > > > As there are no extra parameters added, trivially, by extension theorem this is always full rank.