design matrix missing row

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

design matrix missing row

Postby aswea » Mon May 03, 2010 2:17 pm

Hello!

It seems that my design matrix is missing a row for a CJS model where survival was constrained to be a function of Distance travelled. It worries me and I was wondering if anyone could offer an explanation?

I am using RMark 1.9.6 with R 2.11 and MARK v 5.1 (at least I think that's the version as I seem to also be running Windows 5.1).

I am estimating survival for three stocks of fish as they move down the Columbia River over a series of seven acoustic telemetry receivers. Only one stock (Dworshak) travelled over all seven; the other two joined at different locations. The design matrix is missing a row for one stock (Yakima) at time 4 (location 4). Recapture probability was terrible at time 4, but there were 22 fish detected from the Yakima stock (ie the row is not missing because there were no fish detected).

Here is the .ddl for Phi:
group cohort age time Cohort Age Time STOCK RELEASE Dist Ocean FW
23 BARGE1 5 0 5 4 0 4 BARGE 1 200 0 1
24 BARGE1 5 1 6 4 1 5 BARGE 1 63 1 0
25 BARGE1 5 2 7 4 2 6 BARGE 1 540 1 0
29 DWORSHAK1 1 0 1 0 0 0 DWORSHAK 1 190 0 1
30 DWORSHAK1 1 1 2 0 1 1 DWORSHAK 1 180 0 1
31 DWORSHAK1 1 2 3 0 2 2 DWORSHAK 1 162 0 1
32 DWORSHAK1 1 3 4 0 3 3 DWORSHAK 1 115 0 1
33 DWORSHAK1 1 4 5 0 4 4 DWORSHAK 1 200 0 1
34 DWORSHAK1 1 5 6 0 5 5 DWORSHAK 1 63 1 0
35 DWORSHAK1 1 6 7 0 6 6 DWORSHAK 1 540 1 0
64 YAKIMA1 2 0 2 1 0 1 YAKIMA 1 115 0 1
65 YAKIMA1 2 1 3 1 1 2 YAKIMA 1 162 0 1
66 YAKIMA1 2 2 4 1 2 3 YAKIMA 1 115 0 1
67 YAKIMA1 2 3 5 1 3 4 YAKIMA 1 200 0 1
68 YAKIMA1 2 4 6 1 4 5 YAKIMA 1 63 1 0
69 YAKIMA1 2 5 7 1 5 6 YAKIMA 1 540 1 0
107 BARGE2 5 0 5 4 0 4 BARGE 2 200 0 1
108 BARGE2 5 1 6 4 1 5 BARGE 2 63 1 0
109 BARGE2 5 2 7 4 2 6 BARGE 2 540 1 0
113 DWORSHAK2 1 0 1 0 0 0 DWORSHAK 2 190 0 1
114 DWORSHAK2 1 1 2 0 1 1 DWORSHAK 2 180 0 1
115 DWORSHAK2 1 2 3 0 2 2 DWORSHAK 2 162 0 1
116 DWORSHAK2 1 3 4 0 3 3 DWORSHAK 2 115 0 1
117 DWORSHAK2 1 4 5 0 4 4 DWORSHAK 2 200 0 1
118 DWORSHAK2 1 5 6 0 5 5 DWORSHAK 2 63 1 0
119 DWORSHAK2 1 6 7 0 6 6 DWORSHAK 2 540 1 0
148 YAKIMA2 2 0 2 1 0 1 YAKIMA 2 115 0 1
149 YAKIMA2 2 1 3 1 1 2 YAKIMA 2 162 0 1
150 YAKIMA2 2 2 4 1 2 3 YAKIMA 2 115 0 1
151 YAKIMA2 2 3 5 1 3 4 YAKIMA 2 200 0 1
152 YAKIMA2 2 4 6 1 4 5 YAKIMA 2 63 1 0
153 YAKIMA2 2 5 7 1 5 6 YAKIMA 2 540 1 0

Here is the function to estimate Phi and p: (The FW and Ocean are to designate separate survival rates per kilometer for the freshwater and marine components of the acoustic array)

Col2009rate.models=function()
{
#---Phi---

#FW slope REL to AST. Ocean slope AST to LIPP
Phi.Dist.FW.RELAST.STOCK.time=list(formula=~-1+Dist:STOCK:FW+Dist:STOCK:Ocean, link="log")

#---p---
#fixed detection efficiency to 0.7 which is our best guess estimate
pLippy.indices=as.numeric(row.names(Col2009.ddl$p[Col2009.ddl$p$time==8,]))
pLippy.values=rep(0.7,length(pLippy.indices))

#same formula used in best model from survival analysis
p.time.STOCK.RELEASEfixed=list(formula=~-1+time:STOCK:RELEASE:FW+time:Ocean:RELEASE, fixed=list(index=pLippy.indices, value=pLippy.values))

cml=create.model.list("CJS")
results=mark.wrapper(cml,data=Col2009.process,ddl=Col2009.ddl,adjust=TRUE)
return(results)
}

Here is an excerpt from the design.matrix (showing that there is not a row for Yakima at t4)
Phi:Dist:STOCKBARGE:FW Phi:Dist:STOCKDWORSHAK:FW Phi:Dist:STOCKYAKIMA:FW Phi:Dist:STOCKBARGE:Ocean
Phi gBARGE1 c5 a0 t5 "200" "0" "0" "0"
Phi gBARGE1 c5 a1 t6 "0" "0" "0" "63"
Phi gBARGE1 c5 a2 t7 "0" "0" "0" "540"
Phi gDWORSHAK1 c1 a0 t1 "0" "190" "0" "0"
Phi gDWORSHAK1 c1 a1 t2 "0" "180" "0" "0"
Phi gDWORSHAK1 c1 a2 t3 "0" "162" "0" "0"
Phi gDWORSHAK1 c1 a3 t4 "0" "115" "0" "0"
Phi gDWORSHAK1 c1 a4 t5 "0" "200" "0" "0"
Phi gDWORSHAK1 c1 a5 t6 "0" "0" "0" "0"
Phi gDWORSHAK1 c1 a6 t7 "0" "0" "0" "0"
Phi gYAKIMA1 c2 a0 t2 "0" "0" "115" "0"
Phi gYAKIMA1 c2 a1 t3 "0" "0" "162" "0"
Phi gYAKIMA1 c2 a3 t5 "0" "0" "200" "0"
Phi gYAKIMA1 c2 a4 t6 "0" "0" "0" "0"
Phi gYAKIMA1 c2 a5 t7 "0" "0" "0" "0"
p gBARGE1 c5 a1 t6 "0" "0" "0" "0"

Thank you for your help,

Aswea
aswea
 
Posts: 27
Joined: Sat Oct 17, 2009 3:32 pm
Location: Gander NL

Re: design matrix missing row

Postby jlaake » Mon May 03, 2010 2:40 pm

Aswea-

Don't trust the labels on DMs that go to MARK. They are based on the all-different PIMS and once upon a time meant something. But as soon as I developed the simplification approach for PIMS to reduce DMs, the labels can get screwed up. There are warnings about this in Appendix C and elsewhere but you probably missed them or did not understand. I should probably strip off the labels as they are not trustworthy.

The PIMS are simplified to the smallest set necessary such that the rows in the DM are unique and that is exactly what was done here. Even though you have 4 times for that site, you only have 3 unique values for Dist so it collapsed the 2 rows with the same value of Dist=115. You'll see that t=4 with dist=200 is there but labelled as t=5. If you look at the simplified PIMS you'll see that the index for Yakima1 times 1 and 3 will be the same because it has collapsed it to one parameter because they have the same distance value. Even though they are collapsed in what is sent to MARK, they are reconstructed in RMark with the all-different PIMS and you'll see that t=1,3 will have the same real parameter value with dist=115 and t=4 will have the real value with dist=200.

BTW, good job with the summary of the problem and for providing all of the relevant info that I needed to diagnose the issue.

regards --jeff
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: design matrix missing row

Postby aswea » Mon May 03, 2010 2:51 pm

That's perfect Jeff! Thanks! I've been paying close attention to the labels when combining across stocks and release groups, but I didn't understand that the issue would also occur for repeated covariates. Makes sense.

~Aswea
aswea
 
Posts: 27
Joined: Sat Oct 17, 2009 3:32 pm
Location: Gander NL


Return to RMark

Who is online

Users browsing this forum: No registered users and 0 guests