<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body dir="auto">
<div>Hi Fernando,</div>
<div>Thanks so much for your explanations, deciphering and help. I'll re-inspect my input files as well to see if I can simplify any parameters further. I'll look forward to keeping in touch re how this goes, and of your updates on any function fixes..</div>
<div>Thanks again,</div>
<div>best,</div>
<div>caroline.<br>
</div>
<div><br>
On 18/09/2013, at 11:35 PM, "Fernando Colchero" <<a href="mailto:colchero@imada.sdu.dk">colchero@imada.sdu.dk</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>Hi Caroline,
<div><br>
</div>
<div>  Well, the latest recorded year being 149 is because for individual 1465 in your "penults_birthdeath.csv" table you have that the death date is 149. </div>
<div><br>
</div>
<div>   The second problem, which is an issue with MakeCovMat() that we need to fix, is that, if you specify the covariates just by their name, the function will assume that you want to model the covariates all with interactions. With the tables you gave me,
 that produces more than 2,000 covariates, which is one quarter of the total number of points in your dataset. To avoid this, you can use the following code:</div>
<div><br>
</div>
<div>
<div style="margin: 0px 0px 0px 4px; text-indent: -4px; font-size: 14.5px; font-family: Monaco; color: rgb(176, 22, 0); ">
<span style="color: #000000">covarsRaw</span><span style="color: #071a99"> <- read.csv(</span>"fixed_covars.csv"<span style="color: #071a99">)</span></div>
</div>
<div>
<div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div>
<div style="margin: 0px 0px 0px 4px; text-indent: -4px; font-size: 14.5px; font-family: Monaco; ">
covars <span style="color: #071a99"><- MakeCovMat(~</span>SPECIES <span style="color: #071a99">
+ </span>CLADE <span style="color: #071a99">+</span> POP<span style="color: #071a99">,</span> data
<span style="color: #071a99">=</span> covarsRaw<span style="color: #071a99">)</span></div>
<span style="font-size: 12px; "><br>
</span></div>
<div><span style="font-size: 12px; ">  </span>In this way, you'll have only 45, which are a lot, but it's better than 2,000... </div>
<div><br>
</div>
<div>  Another problem, is that, your range of dates go from -5 to 109, so when you specify a 0 in the death or birth dates, it's not clear with of the 0s are missing values and which are actual dates. This is not your fault and it's something that we need
 to fix from BaSTA. If you could add up say, 200 to the real dates, then a 0 would actually mean a real missing value.</div>
<div><br>
</div>
<div>   There's still an issue when prepping the parameters that makes that the algorithm doesn't move. We're working on it. We'll get you an answer as soon as possible.</div>
<div><br>
</div>
<div>   Best,</div>
<div><br>
</div>
<div>   Fernando</div>
<div>  </div>
<div><span style="font-size: 12px; "><br>
</span></div>
<div><b style="font-size: 12px; ">Fernando Colchero</b></div>
<div><span style="font-size: 12px; ">Assistant Professor</span></div>
<div><span style="font-size: 12px; ">Department of Mathematics and Computer Science</span></div>
<div><span style="font-size: 12px; ">Max-Planck Odense Center on the Biodemography of Aging</span></div>
<div><b><i style="font-size: 12px; "><br>
</i></b></div>
<div><span style="font-size: 12px; ">Tlf.               +45 65 50 23 24</span></div>
<div><span style="font-size: 12px; ">Email           <a href="mailto:colchero@imada.sdu.dk">
colchero@imada.sdu.dk</a></span></div>
<div><span style="font-size: 12px; ">Web             <a href="http://www.sdu.dk/staff/colchero">www.sdu.dk/staff/colchero</a></span></div>
<div><span style="font-size: 12px; ">Pers. web   <a href="http://www.sdu.dk/staff/colchero">www.colchero.com</a></span></div>
<div><span style="font-size: 12px; ">Adr.              Campusvej 55, 5230, Odense, Dk</span></div>
<div><span style="font-size: 12px; "><br>
</span></div>
<div>
<div><b>University of Southern Denmark</b></div>
<div><b><i style="font-size: 12px; "><br>
</i></b></div>
</div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<span style="font-size: 12px; "><br>
</span></div>
<br class="Apple-interchange-newline" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<br class="Apple-interchange-newline">
</div>
</div>
</div>
<br>
<div>
<div>On Sep 17, 2013, at 4:08 AM, Caroline Chong <<a href="mailto:caroline.chong@anu.edu.au">caroline.chong@anu.edu.au</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>
<div style="word-wrap:break-word">Dear Fernando,
<div><br>
</div>
<div>I have attempted to run using multiple categorical covariates (input covariates csv attached) but seem to have encountered a similar problem. ("Latest recorded death year" reports as 149 which is outside my range of observations).</div>
<div><br>
</div>
<div>Would you be able to suggest how to fix this in order to run MultiBasta? Also, may I enquire what might be an expected run time for model = "GO", nsim = 4, parallel = TRUE, ncpus = 4, updateJumps = TRUE - i.e. in the order of minutes, hours (or days?)</div>
<div><br>
</div>
<div>Greatest thanks for your assistance,</div>
<div>with best regards</div>
<div>Caroline.</div>
<div><br>
</div>
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
<div><br>
</div>
<div>
<div>cv <- read.csv("CaptHist.csv")</div>
<div>rd <- cv$ROBSDATES</div>
<div>class(rd)</div>
<div>sum(is.na(cv))</div>
<div>rd<-as.Date(rd)</div>
<div>Y <- CensusToCaptHist(ID = cv[,1], d=rd, timeInt="D")</div>
<div>head(Y)</div>
<div>sum(is.na(cv))</div>
<div>birthDeath <- read.csv("penults_birthdeath.csv")</div>
<div><b>covar <- read.csv("~/fixeda_covars.csv")</b></div>
<div><b>covars <- MakeCovMat(x= c("SPECIES", "SUBGEN", "CLADE", "SECT", "LOCAT"), data = covar)</b></div>
<div><br>
</div>
<div>colnames(covars)[-1] <- letters[1:(ncol(covars) - 1)]</div>
<div>dat <- data.frame(birthDeath, Y[, -1], covars[, -1])</div>
</div>
<div>
<div>dat2 <- DataCheck(dat, studyStart = 1, studyEnd = 109, autofix = rep(1, 7), silent = FALSE)</div>
<div><br>
</div>
<div>The following rows deaths occur before observations start:</div>
<div>[1] 550 689</div>
<div>These records have been removed from the Dataframe</div>
<div>The following rows have observations that occur after the year of death:</div>
<div>  [1]    2   20   22   41   42   ..........</div>
<div>Observations that post-date year of death have been removed.</div>
<div><br>
</div>
<div>The following rows have observations that occur before the year of birth:</div>
<div>  [1]  298  299  300  301  .........</div>
<div>[673] 1706 1707 1710 1711 1712 1715 1716 1717 1718</div>
<div>Observations that pre-date year of birth have been removed.</div>
<div><br>
</div>
<div>The following rows have a one in the recapture matrix in the birth year:</div>
<div> [1]  14  25  36  47  58  80  91 102 113 114 125 136 147 158 169 191 213 224 225 236</div>
<div>[21] 247 258 269 280</div>
<div>*DataSummary*</div>
<div>- Number of individuals         =    1,718 </div>
<div>- Number with known birth year  =    1,260 </div>
<div>- Number with known death year  =     361 </div>
<div>- Number with known birth</div>
<div> AND death years                =      97 </div>
<div><br>
</div>
<div>- Total number of detections</div>
<div> in recapture matrix            =    8,789 </div>
<div><br>
</div>
<div>- Earliest detection time       =       1 </div>
<div>- Latest detection time         =     109 </div>
<div>- Earliest recorded birth year  =       1 </div>
<div>- Latest recorded birth year    =     108 </div>
<div>- Earliest recorded death year  =      16 </div>
<div>- Latest recorded death year    =     149 </div>
<div><br>
</div>
<div>> source("/Users/caroline/BASTA/MultiBaSTA.r")</div>
<div>> multiOut <- MultiBaSTA(dat2$newDat, studyStart = 1, studyEnd = 109, nsim=4, parallel = TRUE, ncpus = 4, models = c("GO"), shape = "simple", covarStruct="all.in.mort", updateJumps = TRUE)</div>
<div><br>
</div>
<div>--------------------------</div>
<div>Run number 1, model: Go.Si</div>
<div>--------------------------</div>
<div>No problems were detected with the data.</div>
<div><br>
</div>
<div>Starting simulation to find jump sd's... </div>
<div>
<div>On 14/09/2013, at 2:24 PM, Fernando Colchero wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap:break-word">Hi Caroline,
<div><br>
</div>
<div>   In principle yes, but let us know if you find any problems.</div>
<div><br>
</div>
<div>  best,</div>
<div><br>
</div>
<div>  Fernando<br>
<div>
<div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; word-wrap: break-word; ">
<div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; word-wrap: break-word; ">
<div style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium; ">
<div><span style="font-size:12px"><br class="x_Apple-interchange-newline">
<br>
</span></div>
<div><span style="font-size:12px"><br>
</span></div>
<div><b style="font-size:12px">Fernando Colchero</b></div>
<div><span style="font-size:12px">Assistant Professor</span></div>
<div><span style="font-size:12px">Department of Mathematics and Computer Science</span></div>
<div><span style="font-size:12px">Max-Planck Odense Center on the Biodemography of Aging</span></div>
<div><b><i style="font-size:12px"><br>
</i></b></div>
<div><span style="font-size:12px">Tlf.               +45 65 50 23 24</span></div>
<div><span style="font-size:12px">Email           <a href="mailto:colchero@imada.sdu.dk">
colchero@imada.sdu.dk</a></span></div>
<div><span style="font-size:12px">Web             <a href="http://www.sdu.dk/staff/colchero">www.sdu.dk/staff/colchero</a></span></div>
<div><span style="font-size:12px">Pers. web   <a href="http://www.sdu.dk/staff/colchero">www.colchero.com</a></span></div>
<div><span style="font-size:12px">Adr.              Campusvej 55, 5230, Odense, Dk</span></div>
<div><span style="font-size:12px"><br>
</span></div>
<div>
<div><b>University of Southern Denmark</b></div>
<div><b><i style="font-size:12px"><br>
</i></b></div>
</div>
</div>
<div style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium; ">
<span style="font-size:12px"><br>
</span></div>
<br class="x_Apple-interchange-newline" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium; ">
<br class="x_Apple-interchange-newline">
</div>
</div>
</div>
<br>
<div>
<div>On Sep 14, 2013, at 4:38 AM, Caroline Chong <<a href="mailto:caroline.chong@anu.edu.au">caroline.chong@anu.edu.au</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap:break-word">Hi Fernando,
<div><br>
</div>
<div>Oh, that's brilliant. Thanks for explaining the problem! I have managed to run using the temporary fix and will let you know if I encounter any to the contrary as I try out different covariate combinations etc.</div>
<div>To confirm - should this code be ok to run regardless of the type or combination of covariates I select to run? e.g. multiple categorical covariates, or a mixture of integer and categorical covariates - I am intending to incorporate these into the analysis
 also.</div>
<div><br>
</div>
<div>Many thanks,</div>
<div>Caroline.</div>
<div><br>
<div>
<div>On 13/09/2013, at 11:01 PM, Fernando Colchero wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap:break-word">Hi Caroline,
<div><br>
</div>
<div>   I found the problem. The issue is not with the data but a bug in the code when assigning parameter names to the covariates. The names in your CLADE covariates conflicted with the way BaSTA processes the results and finds the parameters. We have to fix
 it but, for the time being, here's a temporary solution so you can run your analyses:</div>
<div><br>
</div>
<div>
<div>cv <- read.csv("CaptHist.csv")</div>
<div><br>
</div>
<div>rd <- cv$ROBSDATES</div>
<div>class(rd)</div>
<div>sum(is.na(cv))</div>
<div>rd<-as.Date(rd)</div>
<div>Y <- CensusToCaptHist(ID = cv[,1], d=rd, timeInt="D")</div>
<div>head(Y)</div>
<div>sum(is.na(cv))</div>
<div><br>
</div>
<div>birthDeath <- read.csv("penults_birthdeath.csv")</div>
<div>covar <- read.csv("fixed_covars.csv")</div>
<div><br>
</div>
<div>covars <- MakeCovMat(x= "CLADE", data = covar)</div>
<div><br>
</div>
<div># Here's the way to avoid the problem:</div>
<div>colnames(covars)[-1] <- letters[1:(ncol(covars) - 1)]</div>
<div>dat <- data.frame(birthDeath, Y[, -1], covars[, -1])</div>
<div><br>
</div>
<div>dat2 <- DataCheck(dat, studyStart = 1, studyEnd = 109, autofix = rep(1, 7), </div>
<div>                  silent = FALSE)</div>
<div>out <- basta(dat2$newDat, studyStart = 1, studyEnd = 109, updateJumps = FALSE)</div>
<div><br>
</div>
<div><br>
</div>
<div>  Let me know if this works. Best,</div>
<div><br>
</div>
<div>   Fernando</div>
<div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b style="font-size:12px"><br class="x_Apple-interchange-newline">
Fernando Colchero</b></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Assistant Professor</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Department of Mathematics and Computer Science</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Max-Planck Odense Center on the Biodemography of Aging</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b><i style="font-size:12px"><br>
</i></b></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Tlf.               +45 65 50 23 24</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Email           <a href="mailto:colchero@imada.sdu.dk">colchero@imada.sdu.dk</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Web             <a href="http://www.sdu.dk/staff/colchero">www.sdu.dk/staff/colchero</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Pers. web   <a href="http://www.sdu.dk/staff/colchero">www.colchero.com</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Adr.              Campusvej 55, 5230, Odense, Dk</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px"><br>
</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b>University of Southern Denmark</b></div>
</div>
<br>
<div>
<div>On 13 Sep 2013, at 12:08, Caroline Chong <<a href="mailto:caroline.chong@anu.edu.au">caroline.chong@anu.edu.au</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<blockquote type="cite">
<div>
<div style="word-wrap:break-word">Hi Fernando,
<div>These errors are with the data attached here (and with my latest "errors in inputMat" email).</div>
<div><br>
</div>
<div>Thanks so much for taking a look!!</div>
<div><br>
</div>
<div>best,</div>
<div>Caroline.</div>
<div>"CaptHist.csv" = census matrix</div>
<div>"penults_birthdeath.csv" = birthDeath matrix</div>
<div>"fixed_covars.csv" = covariate matrix</div>
<div><br>
</div>
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div><br>
<div>
<div>On 13/09/2013, at 7:49 PM, Fernando Colchero wrote:</div>
<br class="x_x_Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap:break-word">Hi Caroline,
<div><br>
</div>
<div>   Are these errors with the data you sent me? If so, I'll run them myself and get back to you asap.</div>
<div><br>
</div>
<div>  Best,</div>
<div><br>
</div>
<div>  Fernando<br>
<div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b style="font-size:12px"><br class="x_x_Apple-interchange-newline">
Fernando Colchero</b></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Assistant Professor</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Department of Mathematics and Computer Science</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Max-Planck Odense Center on the Biodemography of Aging</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b><i style="font-size:12px"><br>
</i></b></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Tlf.               +45 65 50 23 24</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Email           <a href="mailto:colchero@imada.sdu.dk">colchero@imada.sdu.dk</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Web             <a href="http://www.sdu.dk/staff/colchero">www.sdu.dk/staff/colchero</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Pers. web   <a href="http://www.sdu.dk/staff/colchero">www.colchero.com</a></span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px">Adr.              Campusvej 55, 5230, Odense, Dk</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<span style="font-size:12px"><br>
</span></div>
<div style="font-family:Helvetica; font-size:medium; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px">
<b>University of Southern Denmark</b></div>
</div>
<br>
<div>
<div>On 13 Sep 2013, at 09:58, Caroline Chong <<a href="mailto:caroline.chong@anu.edu.au">caroline.chong@anu.edu.au</a>> wrote:</div>
<br class="x_x_Apple-interchange-newline">
<blockquote type="cite">
<div>
<div style="word-wrap:break-word">
<div>Dear BaSTA</div>
<div><br>
</div>
<div>Owen, and Fernando - thanks for your assistance with my previous birth-death coding issue (rowSums error)- happy to report that I was able to re-code this successfully and DataCheck now passes with no errors.</div>
<div><br>
</div>
<div>However I am running into the below two errors - would you be able to solve or decipher what the issue is? Firstly in the final compiled matrix (im2 = inputMat), every single observation now has a recorded Death observation whereas this is not the case
 in my input birthDeath matrix. I tried editing this via bd.na (below code) but this didn't work. Is there some possible issue when reading 0s in the birth and death columns?</div>
<div><br>
</div>
<div>##e.g. original births and deaths observation matrix</div>
<div>
<div>> head(birthDeath)</div>
<div>  ID birth death</div>
<div>1  1     0    68</div>
<div>2  2     0    68</div>
<div>3  3     0     0</div>
<div>4  4     1     0</div>
<div>5  5     1     0</div>
<div>6  6     1     0</div>
<div>## whereas final merged matrix below shows:</div>
</div>
<div>
<div>> head(im2)</div>
<div>ID birth death 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40</div>
<div>1     1     0    53 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0</div>
<div>10    2     0    99 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0</div>
<div>100   3     0    99 1 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0</div>
<div>1000  4     8   103 0 0 0 0 0 0 0 0 1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0</div>
<div>1001  5     8   103 0 0 0 0 0 0 0 0 1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0</div>
<div>1002  6     8   103 0 0 </div>
</div>
<div>
<div>> dc <- DataCheck(im2, studyStart = 1, studyEnd = 109, autofix = rep(1, 7), silent=FALSE)</div>
<div>No problems were detected with the data.</div>
<div><br>
</div>
<div>*DataSummary*</div>
<div>- Number of individuals         =    1,720 </div>
<div>- Number with known birth year  =    1,428 </div>
<div>- Number with known death year  =    1,720 </div>
<div>- Number with known birth</div>
<div> AND death years                =    1,428 </div>
<div><br>
</div>
<div>- Total number of detections</div>
<div> in recapture matrix            =   10,339 </div>
<div><br>
</div>
<div>- Earliest detection time       =       1 </div>
<div>- Latest detection time         =     109 </div>
<div>- Earliest recorded birth year  =       1 </div>
<div>- Latest recorded birth year    =     107 </div>
<div>- Earliest recorded death year  =       2 </div>
<div>- Latest recorded death year    =     109 </div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Secondly on running basta (run time to error 20mins) I get returned e.g.</div>
<div><br>
</div>
<div>> out <- basta(object = im2, studyStart = 1, studyEnd = 109)</div>
<div>
<div>No problems were detected with the data.</div>
<div><br>
</div>
<div>Starting simulation to find jump sd's...  done.</div>
<div><br>
</div>
<div>Simulation started...</div>
</div>
<div><br>
</div>
<div><b>Error in `colnames<-`(`*tmp*`, value = c("b0", "b1")) : </b></div>
<div><b>  length of 'dimnames' [2] not equal to array extent</b></div>
<div><br>
</div>
<div> It appears that the dimensions of the matrix are not 2 - is this correct?, which I am unsure how to interpret or fix.</div>
<div><br>
</div>
<div>looking forward to hearing back,</div>
<div>many thanks for your help,</div>
<div>best regards</div>
<div>Caroline.</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div><br>
</div>
<div>cv <- read.csv("~/CaptHist.csv")</div>
<div>rd <- cv$ROBSDATES</div>
<div>class(rd)</div>
<div>sum(is.na(cv))</div>
<div>rd<-as.Date(rd)</div>
<div>Y <- CensusToCaptHist(ID = cv[,1], d=rd, timeInt="D")</div>
<div>head(Y)</div>
<div>sum(is.na(cv))</div>
<div><br>
</div>
<div>birthDeath <- read.delim("~/penults_birthdeath.csv", sep=",", header=T)</div>
<div><br>
</div>
<div>bd.na <- t( # the below returns a transposed matrix, so we have to re-transpose it back to normal</div>
<div>  apply( # foreach row (hence 1) in the birth dates matrix</div>
<div>    birthDeath, 1,</div>
<div>    function(r) { # apply by row this function (hence r)</div>
<div>      if(r[2] == 0) { # if birth [2] is 0</div>
<div>        r[2] <- NA # replace birth value with NA (R's missing data value)</div>
<div>      }</div>
<div>      if (r[3] == 0) { # if death [3] is 0</div>
<div>        r[3] <- NA # replace death value with NA (R's missing data value)</div>
<div>      }</div>
<div>      return(r) # return the whole row</div>
<div>    }</div>
<div>  ))</div>
<div><br>
</div>
<div>table(is.na(bd.na[,3]))</div>
<div>BD <- bd.na</div>
<div>head(BD)</div>
<div>covar <- read.delim("~/fixed_covars.csv", sep=",", header=T)</div>
<div>head(covar)</div>
<div>covMat <- MakeCovMat(x=c("CLADE"), data = covar)</div>
<div>days <- as.numeric(colnames(Y)[2:ncol(Y)])</div>
<div>y <- as.matrix(Y)</div>
<div>bd <- apply(y,1,function(r) min(as.numeric(days[as.logical(r[2:ncol(Y)])]))) -1</div>
<div>dd <- apply(y,1,function(r) max(as.numeric(days[as.logical(r[2:ncol(Y)])])))</div>
<div>inputMat <- as.data.frame(cbind(BD, Y[, -1], covMat[, -1]))</div>
<div>##inputMat <- merge(BD, Y, by.x = "ID", by.y = "ID")</div>
<div>##inputMat <- merge(inputMat, covMat, by.x = "ID", by.y = "ID")</div>
<div>dim(inputMat)</div>
<div>colnames(inputMat)</div>
<div>im2 <- inputMat</div>
<div>im2[,2] <- bd</div>
<div>im2[,3] <- dd</div>
<div>head(im2)</div>
<div>dc <- DataCheck(im2, studyStart = 1, studyEnd = 109, autofix = rep(1, 7), silent=FALSE)</div>
<div>names(dc)</div>
<div>head(inputMat)</div>
<div># outMat <- dc$newData</div>
<div>out <- basta(object = im2, studyStart = 1, studyEnd = 109)</div>
</div>
</div>
<div><br>
</div>
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
<div style="word-wrap:break-word">
<div></div>
</div>
</div>
<span><penults_birthdeath.csv></span><span><fixed_covars.csv></span><span><CaptHist.csv></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<span><penults_birthdeath.csv></span><span><fixed_covars.csv></span><span><CaptHist.csv></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<span><fixeda_covars.csv></span><span><CaptHist.csv></span><span><penults_birthdeath.csv></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</body>
</html>