<div dir="ltr"><div dir="ltr"><div dir="ltr">Dear rcpp-dlevel members,<div><br></div><div><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">Hopefully, you may be able to shed some light on a problem that I have regarding ‘speeding up’ the R function nlme::gls which I use for fitting models with temporal autocorrelation. In a vignette by Doug Bates and Dirk Eddelbuettel (</span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"><a href="https://cran.r-project.org/web/packages/RcppEigen/vignettes/RcppEigen-Introduction.pdf" target="_blank">https://cran.r-project.org/web/packages/RcppEigen/vignettes/RcppEigen-Introduction.pdf</a></span><span style="font-size:11pt">), I found that they used</span><span style="font-size:11pt"> RcppEigen to solve some least-squares problems, but I wasn’t sure if this could be extended to generalised least squares?</span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><span> </span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">The current function nlme::gls takes hours to execute and I was hoping to use the Rcpp framework to ameliorate this problem, but I have little experience in Rcpp or C++ programming and wasn’t sure if this had already been tackled. After extensive searching on the web, I haven’t found any implementation. Does anyone have any ideas or advice please?<span></span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><span> </span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">My model syntax in R is currently as follows:<span></span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><span> </span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">myfit <- gls(y~stim1+stim2+t+I(t^2)+I(t^3)+signal+stim1_signal,data=mydata, correlation=corAR1(form=~t))<span></span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><br></span></p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:14.666666984558105px">Some other information, each time series has approximately 20,000 observations.</span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><span> </span></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">Thank you in advance for any help.</span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt"><br></span></p><p class="MsoNormal" style="font-size:12pt;margin:0cm 0cm 0.0001pt;font-family:Calibri,sans-serif;color:rgb(0,0,0)"><span style="font-size:11pt">Paul</span></p></div></div></div></div>