[ADMB Users] Splines in ADMB-RE

Mark Payne mpa at aqua.dtu.dk
Wed Jun 8 01:40:06 PDT 2011


Hi,

I am having problems using splines in conjunction with an ADMB-RE model. What I am trying to do is fairly simple - I have a set of measurements irregularlary-distributed in time across an annual cycle (e.g. daily temperature measurements for a year with gaps) that I would like to use to produce a smooth annual cycle. I have decided to represent this data as a random walk with monthly steps, and then use a cubic spline to interpolate down to the appropriate time point for the observation.

I have been able to set this up and get it to run fine in normal ADMB - see attached code. I've compiled it and run it as follows:

touch re_spline.dat
admb -s re_spline
./re_spline

The following lines of R will plot a figure showing you the fit and the knots:

d <- read.table("re_spline.rep",header=TRUE); plot(d$time,d$obs); lines(d$time,d$pred,lwd=2,col="red"); a<-read.table("knots.txt",header=TRUE); points(a$time,a$knot,pch=19,col="green",cex=2)

(the attached png shows you how this looks)

That looks fine. However, I would like to switch the model to ADMB-RE now, so that I have the monthly-time-steps as random-effects. The problem is that splines in ADMB-RE don't seem to be overloaded for the random_effects types: converting line 30 of my tpl from
  init_vector yatKnots(1,nknots)     //y values along the monthly random walk
 to
  random_effects_vector yatKnots(1,nknots)     //y values along the monthly random walk

and then compiling gives the error at the bottom.

Have I interpreted this error correctly ie there no splines for random-effects? Has this been overlooked in ADMB-RE or am I doing something that is obviously stupid? Is there a better way to approach such a problem?

Best wishes,

Mark


[mpayne at oleander run]$ admb -r -s re_spline

*** tpl2rem -bounds re_spline

*** adcomp -r -s re_spline
g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DSAFE_ALL -DUSE_LAPLACE -fpermissive -I. -I/home/mpayne/Software/admb/include re_spline.cpp
re_spline.cpp: In member function ‘virtual void df1b2_parameters::user_function()’:
re_spline.cpp:152: error: no matching function for call to ‘vcubic_spline_function::vcubic_spline_function(dvector&, df1b2_init_vector&, double, double)’
/home/mpayne/Software/admb/include/fvar.hpp:5305: note: candidates are: vcubic_spline_function::vcubic_spline_function(const dvector&, const dvar_vector&, dvariable)
/home/mpayne/Software/admb/include/fvar.hpp:5303: note:                 vcubic_spline_function::vcubic_spline_function(const dvector&, const dvar_vector&, dvariable, dvariable)
/home/mpayne/Software/admb/include/fvar.hpp:5301: note:                 vcubic_spline_function::vcubic_spline_function(const dvector&, const dvar_vector&, double, double)
/home/mpayne/Software/admb/include/fvar.hpp:5296: note:                 vcubic_spline_function::vcubic_spline_function(const vcubic_spline_function&)
re_spline.cpp:153: error: no match for ‘operator=’ in ‘((df1b2_parameters*)this)->df1b2_parameters::predicted_obs = vcubic_spline_function::operator()(const dvector&)(((const dvector&)((const dvector*)(&((df1b2_parameters*)this)->df1b2_parameters::<anonymous>.df1b2_pre_parameters::<anonymous>.model_parameters::<anonymous>.model_data::obs_time))))’
/home/mpayne/Software/admb/include/df1b2fun.h:952: note: candidates are: df1b2vector& df1b2vector::operator=(const df3_one_vector&)
/home/mpayne/Software/admb/include/df1b2fun.h:953: note:                 df1b2vector& df1b2vector::operator=(const df1b2vector&)
/home/mpayne/Software/admb/include/df1b2fun.h:954: note:                 df1b2vector& df1b2vector::operator=(const dvector&)
/home/mpayne/Software/admb/include/df1b2fun.h:955: note:                 df1b2vector& df1b2vector::operator=(double)
/home/mpayne/Software/admb/include/df1b2fun.h:956: note:                 df1b2vector& df1b2vector::operator=(const df1b2variable&)
/home/mpayne/Software/admb/include/df1b2fun.h:957: note:                 df1b2vector& df1b2vector::operator=(const df3_two_vector&)

Error: could not create re_spline.o

[mpayne at oleander run]$





 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: re_spline.tpl
Type: application/vnd.groove-tool-template
Size: 2289 bytes
Desc: re_spline.tpl
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110608/5a13b138/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cycle.png
Type: image/png
Size: 44349 bytes
Desc: Cycle.png
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110608/5a13b138/attachment.png>


More information about the Users mailing list