<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">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="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; "><b style="font-size: 12px; "><br class="Apple-interchange-newline">Fernando Colchero</b></div><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; "><span style="font-size: 12px; ">Assistant Professor</span></div><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; "><span style="font-size: 12px; ">Department of Mathematics and Computer Science</span></div><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; "><span style="font-size: 12px; ">Max-Planck Odense Center on the Biodemography of Aging</span></div><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; "><b><i style="font-size: 12px; "><br></i></b></div><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; "><span style="font-size: 12px; ">Tlf. +45 65 50 23 24</span></div><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; "><span style="font-size: 12px; ">Email <a href="mailto:colchero@imada.sdu.dk">colchero@imada.sdu.dk</a></span></div><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; "><span style="font-size: 12px; ">Web <a href="http://www.sdu.dk/staff/colchero">www.sdu.dk/staff/colchero</a></span></div><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; "><span style="font-size: 12px; ">Pers. web <a href="http://www.sdu.dk/staff/colchero">www.colchero.com</a></span></div><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; "><span style="font-size: 12px; ">Adr. Campusvej 55, 5230, Odense, Dk</span></div><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; "><span style="font-size: 12px; "><br></span></div><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; "><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="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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_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_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_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></body></html>