[ADMB Users] Matrix functions for ADMB-RE
Stirrup, Oliver
oliver.stirrup.13 at ucl.ac.uk
Fri Jun 27 07:06:19 PDT 2014
Dear ADMB users,
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.
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:
http://www.admb-project.org/examples/growth-models/orange-trees
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.
If anyone could suggest how I could get this running I would be very grateful.
Best wishes
Oliver
Oliver Stirrup
PhD Student
MRC Clinical Trials Unit at UCL
Institute of Clinical Trials & Methodology
London, UK
e-mail: oliver.stirrup.13 at ucl.ac.uk
dave fournier
May 2
Other recipients: us... at admb-project.org
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
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);
nLL+=.5*(nobs*log(2*M_PI)+ld+ diff*diff);
and then to add this section at the bottom of your tpl file.
GLOBALS_SECTION
#include <admodel.h>
#include <df1b2fun.h>
#include <adrndeff.h>
df1b2vector solve(const df1b2matrix& aa,const df1b2vector& z,
const df1b2variable & ln_unsigned_det,double& sign);
df1b2vector solve(const df1b2matrix& aa,const df1b2vector& z,
const df1b2variable & ld,df1b2variable& sign)
{
double sgn;
return solve(aa,z,ld,sgn);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20140627/f01b9e99/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 43 bytes
Desc: image001.gif
URL: <http://lists.admb-project.org/pipermail/users/attachments/20140627/f01b9e99/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: orange_MVN.tpl
Type: application/octet-stream
Size: 2810 bytes
Desc: orange_MVN.tpl
URL: <http://lists.admb-project.org/pipermail/users/attachments/20140627/f01b9e99/attachment.obj>
More information about the Users
mailing list