<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.gfo--0qcvb
        {mso-style-name:gfo--0qcvb;}
span.gfo--0qjfb
        {mso-style-name:gfo--0qjfb;}
span.gfo--0qaeb
        {mso-style-name:gfo--0qaeb;}
span.gfo--0qpdb
        {mso-style-name:gfo--0qpdb;}
span.gfo--0qkgb
        {mso-style-name:gfo--0qkgb;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Dear ADMB users,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I contacted this list a couple of months ago asking for help in using matrix functions in the random effects mode of ADMB. My request was kindly met with responses, but I was unfortunately not able to implement any of the suggestions successfully.
 After a break from the problem, I have now returned to it but have not succeeded in making any progress.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have been attempting to (needlessly) implement a multivariate normal calculation of the log-likelihood in the ‘orange trees’ model template as a toy example, with the original version of the TPL file and data found at:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><a href="http://www.admb-project.org/examples/growth-models/orange-trees">http://www.admb-project.org/examples/growth-models/orange-trees</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In the attached edited version of the TPL file I have tried to implement the solution that Dave Fournier suggested for this problem, but I am receiving the error “conversion from 'dvar_vector' to non-scalar type 'df1b2vector' requested”
 for the “solve” line on attempted compilation.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If anyone could suggest how I could get this running I would be very grateful.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best wishes<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Oliver<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">Oliver Stirrup<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">PhD Student<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">MRC Clinical Trials Unit at UCL<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">Institute of Clinical Trials & Methodology<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">London, UK<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Verdana","sans-serif";mso-fareast-language:EN-GB">e-mail:                         
<a href="oliver.stirrup.13@ucl.ac.uk"><span style="color:blue">oliver.stirrup.13@ucl.ac.uk</span></a><o:p></o:p></span></p>
<div style="mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><o:p> </o:p></p>
</div>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" style="padding:0cm 0cm 0cm 0cm"></td>
<td valign="top" style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";color:#222222;mso-fareast-language:EN-GB">dave fournier</span><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB">
<o:p></o:p></span></p>
</td>
<td valign="top" style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" align="right" style="text-align:right"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB"><img border="0" width="1" height="1" id="Picture_x0020_1" src="cid:image001.gif@01CF9217.5983B2A0" alt="https://groups.google.com/forum/clear.cache.gif"></span><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" align="right" style="text-align:right"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB">May 2
<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB">Other recipients: us...@admb-project.org
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB">Turns out that there is a stupid mismatch between the solve for dvariables and the solve for df1b2variables. Easiest workaround is to change
 sgn to a dvariable in the tpl as in dvariable ld; dvariable sgn; df1b2vector tmp=solve(varcov,diff,ld,sgn
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:EN-GB">Turns out that there is a stupid mismatch between the solve for
<br>
dvariables and the<br>
solve for df1b2variables. Easiest workaround is to change sgn to a <br>
dvariable in the<br>
tpl as in<br>
<br>
<br>
<br>
dvariable ld;<br>
dvariable sgn;<br>
df1b2vector tmp=solve(varcov,diff,ld,sgn);<br>
<br>
nLL+=.5*(nobs*log(2*M_PI)+ld+ diff*diff);<br>
<br>
<br>
and then to add this section at the bottom of your tpl file.<br>
<br>
<br>
<br>
GLOBALS_SECTION<br>
<br>
#include <admodel.h><br>
#include <df1b2fun.h><br>
#include <adrndeff.h><br>
<br>
df1b2vector solve(const df1b2matrix& aa,const df1b2vector& z,<br>
const df1b2variable & ln_unsigned_det,double& sign);<br>
<br>
<br>
df1b2vector solve(const df1b2matrix& aa,const df1b2vector& z,<br>
const df1b2variable & ld,df1b2variable& sign)<br>
{<br>
double sgn;<br>
return solve(aa,z,ld,sgn);<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>