[ADMB Users] Splines in ADMB-RE

H. Skaug hskaug at gmail.com
Thu Jun 9 00:54:05 PDT 2011


Hi,

I do not think this is implemented.  However, you can easily set up
the spline design matrix in R and read that into ADMB-Re:

http://admb-project.org/examples/gam

The R code that produces union.dat is attached. In this way
you do not need any support for splines in ADMB.

Hans

On Wed, Jun 8, 2011 at 9:40 AM, Mark Payne <mpa at aqua.dtu.dk> wrote:
> 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]$
>
>
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union.s
Type: application/octet-stream
Size: 1739 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110609/4be45dfc/attachment.obj>


More information about the Users mailing list