<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=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.gnvmtomcdbb
        {mso-style-name:gnvmtomcdbb;}
span.gnvmtomchab
        {mso-style-name:gnvmtomchab;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:2043288722;
        mso-list-type:hybrid;
        mso-list-template-ids:-1131928238 -1551835572 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Courier New";}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>I have a question about the fastLm example in the Gallery <a href="http://gallery.rcpp.org/articles/fast-linear-model-with-armadillo/">http://gallery.rcpp.org/articles/fast-linear-model-with-armadillo/</a>. I put the code directly into my package (after renaming it fastLmProto so I don’t mask the RcppArmadillo function by the same name). After building the package, I wanted to compare results:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console";color:blue'>> require(datasets)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console";color:blue'>> coef(lm(y1 ~ x1, data = anscombe))<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console";color:black;background:#E1E2E5'>(Intercept)          x1 <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console";color:black;background:#E1E2E5'>  3.0000909   0.5000909 <o:p></o:p></span></p><pre><span class=gnvmtomcdbb><span style='font-family:"Lucida Console";color:blue;background:#E1E2E5'>> </span></span><span class=gnvmtomchab><span style='font-family:"Lucida Console";color:blue;background:#E1E2E5'>coef(fastLmProto(anscombe$y1, as.matrix(anscombe$x1)))<o:p></o:p></span></span></pre><pre><span style='font-family:"Lucida Console";color:black;background:#E1E2E5'>          [,1]<o:p></o:p></span></pre><pre><span style='font-family:"Lucida Console";color:black;background:#E1E2E5'>[1,] 0.7968032<o:p></o:p></span></pre><pre><span class=gnvmtomcdbb><span style='font-family:"Lucida Console";color:blue;background:#E1E2E5'>> </span></span><span class=gnvmtomchab><span style='font-family:"Lucida Console";color:blue;background:#E1E2E5'>coef(fastLm(anscombe$y1, as.matrix(anscombe$x1)))<o:p></o:p></span></span></pre><pre><span style='font-family:"Lucida Console";color:black;background:#E1E2E5'>[1] 1.208169<o:p></o:p></span></pre><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Should I expect the results to match? Why do fastLmProto and fastLm produce a single fitted parameter (I would expect two)? Why are they different? Am I doing something wrong here, or just being naïve in my assumptions?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I reviewed the RcppArmadillo documentation and the article <a href="http://dirk.eddelbuettel.com/papers/RcppArmadillo.pdf">http://dirk.eddelbuettel.com/papers/RcppArmadillo.pdf</a> but could not find anything relevant.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Dale Smith, Ph.D.<o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Senior Financial Quantitative Analyst<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Risk & Compliance<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Fiserv<o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Office: 678-375-5315<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><a href="http://www.fiserv.com/"><span style='color:blue'>www.fiserv.com</span></a></span><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>