Caret gives non-zero test R-squared with linear model without predictors: why? NOT A DUPLICATE For the persons who marked this question as a duplicate of : this is not a duplicate, as the correlation obtained with an intercept-only linear model would be NaN or 0, not 0.1 as mentioned in my post. Further I am asking how to use the most common R squared formulation and no answer is provided to that post.  Original post   I used caret with glmnet and selected repeatedcv (10-fold, 5 repeats) to choose the best glmnet parameters (alpha and lambda) in terms of Rsquared (i.e. better = larger Rsquared).  library(glmnet) library(caret) alpha.grid &lt;- (1:20) * 0.05 lambda.grid &lt;- 10^seq(4,-4,length=200) EN.param.grid &lt;- expand.grid(.alpha=alpha.grid, .lambda=lambda.grid) train.params &lt;- trainControl(method="repeatedcv", number=10, repeats=5) EN.fit &lt;- train(x=X, y=Y, method="glmnet", tuneGrid=EN.param.grid,                  trControl=train.params, standardize=TRUE, metric="Rsquared")   Despite the best model having no remaining predictors (i.e. only an intercept), the associated Rsquared as provided by caret (as seen in EN.fit$results$Rsquared dataframe) should be 0 but it is not (in my case 0.1). Then, questions coming to mind are:   Is the test Rsquared calculated in caret in terms of correlation instead of the more traditional sum-of-squares method (as suggested by )? How to correct this behavior to obtain a test Rsquared of 0 for an intercept-only model (as many would expect), and still be able to correctly optimize a glmnet parameter search on Rsquared?
How caret calculates R Squared From the training output below, it looks like R squared is not calculated by the traditional formula 1 - SSE/SST, since lower error rate has lower R squared. So how is it calculated?    colsample_bytree  min_child_weight  RMSE      Rsquared    0.4               3                 16963.39  0.8799191   0.4               5                 16813.24  0.8788395
Deactivate all \alt,\uncover in beamer (for printing) I have a big latex beamer that uses \alt, \uncover, ... to create "animations".  My goal is to deactivate all these commands temporary (let's say : just use the last state/slide each time there's this kind of thing) to print my document.  Is there a global command to do this or have I to do all this manually (comment manually the commands / or (simpler but still really long) suppress manually pages from the output) ?  Thanks very much in advance for your help. subequations and array in braces Why isn't temperature frame dependent? In (non-relativistic) classical physics, if the temperature of an object is proportional to the average kinetic energy ${1 \over 2} m\overline {v^{2}}$of its particles (or molecules), then shouldn't that temperature depend on the frame of reference - since $\overline {v^{2}}$ will be different in different frames?  (I.e. In the lab frame  $K_l = {1 \over 2} m\overline {v^{2}} $, but in a frame moving with velocity $u$ relative to the lab frame, $K_u =  {1 \over 2} m \overline {(v+u)^{2}}$). How to restart the networking service? I tried to use  sudo service networking restart   and  sudo /etc/init.d/network restart   but they both crash the window manager and I can no longer use my keyboard for input into X.  when I use the /etc/init.d/ method it complains saying that I should use the service utility  e.g. service networking restart   but it crashes just the same.  Is there a GUI method of restarting networking? How to get a toddler to start chewing and eating solids? My son is 18 months old and still doesn't want to chew and eat solid foods. We have to blend soups and other food into purée for him to accept it. If there is even a slight solid, he will automatically push it out of his mouth with his tongue.  I have had a breakthrough with breakfast where I don't blend as much and leave it a little chunky. He ate it but still pushed chunks of soft banana that were bigger out.  Some of my friends have kids that are 4-5 months younger, who are eating chicken cutlets.  Any ideas or proven methods for getting a child to start eating solids? Make a div fill the height of the remaining screen space I am working on a web application where I want the content to fill the height of the entire screen.  The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom.  I have a header div and a content div. At the moment I am using a table for the layout like so:  CSS and HTML    #page {     height: 100%; width: 100% }  #tdcontent {     height: 100%; }  #content {     overflow: auto; /* or overflow: hidden; */ } &lt;table id="page"&gt;     &lt;tr&gt;         &lt;td id="tdheader"&gt;             &lt;div id="header"&gt;...&lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td id="tdcontent"&gt;             &lt;div id="content"&gt;...&lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;     The entire height of the page is filled, and no scrolling is required.  For anything inside the content div, setting top: 0; will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%. Putting header inside content will not allow this to work.  Is there a way to achieve the same effect without using the table?  Update:  Elements inside the content div will have heights set to percentages as well. So something at 100% inside the div will fill it to the bottom. As will two elements at 50%.  Update 2:  For instance, if the header takes up 20% of the screen's height, a table specified at 50% inside #content would take up 40% of the screen space. So far, wrapping the entire thing in a table is the only thing that works. Choosing research ideas to include in a statement of purpose Invalid characters for XML parsing in posthistory.xml from Stack Overflow We got the April 2011 data dump from Stack Overflow and, while trying to put everything into a database, we got      SyntaxError: reference to invalid character number: line 1105549, column 5445   in the middle of the posthistory.xml file. It seems that there are sets of characters (&amp;#xC I believe) within a few posthistory entries which break our XML parser.  Is there a solution besides manually changing all the C's? 3 prong to 4 prong dryer cord change My 2 year old whirlpool dryer has a 3 prong cord. My new house has a 4 prong. The dryer doesn't have a spot for 4 wires. The ground wire coming from the dryer is attached to the dryer itself. A new 4 pronged dryer cord has white, red, black, and green wires. Maybe the green wire hooks to the ground screw with the one coming from the dryer? What does a "< <(...)" redirection mean? I've seen that rvm (ruby version manager) is installed using the following command:  bash &lt; &lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )   So as I understand we get the script content and pass it to the bash (I believe &lt; &lt; and &lt;&lt; is the same thing?) I am interested in the &lt; &lt; part, found following description on the net:     &lt;&lt; token    Means use the current input stream as STDIN for the program until token is seen.    This is somehow not clear for me, can someone make an example or explain it in more simple way? Can sum of a rational number and its reciprocal be an integer? Can sum of a rational number and its reciprocal be an integer?   My brother asked me this question and I was unable to answer it.   The only trivial solutions which I could think of are $1$ and $-1$.  As to what I tried, I am afraid not much. I have never tried to solve such a question, and if someone could point me in the right direction, maybe I could complete it on my own.  Please don't misunderstand my question.   I am looking for a rational number $r$ where $r + \frac{1}{r}$ is an integer. Best way to track onchange as-you-type in input type="text"? How to subtract X days from a date using Java calendar? How do I compare 2 rows from the same table (SQL Server)? I need to create a background job that processes a table looking for rows matching on a particular id with different statuses. It will store the row data in a string to compare the data against a row with a matching id. I know the syntax to get the row data, but I have never tried comparing 2 rows from the same table before. How is it done? Would I need to use variables to store the data from each? Or some other way? (Using SQL Server 2008) Several lines of formulas to the left of one curly brace pointing to equation number How to make several lines of equations under one curly brace from the left side, such that it point to a reference number.  Now I do something like this:  \begin{align} \left. \begin{array}{ll} a = b + c \\ &amp; \dots  \\ a = b + c \\ &amp; \dots  \\ a = b + c  \end{array} \right\} \label{formulas}\\ \end{align}   But equation number appears in the bottom of curly brace. Sequential renaming of files I found an answer for  which works fine for renaming filenames as follows :  1.jpg &gt; 00001.jpg 2.jpg &gt; 00002.jpg . . . 9.jpg &gt; 00009.jpg   That uses the following command:  rename 's/\d+/sprintf("%05d", $&amp;)/e' *.jpg   But my filenames aren't numeric. They are an alphanumeric sequence, like: a.jpg, b.jpg, c.jpg...... m.jpg.  In a similar way to the original question, I want to rename these so they display in the correct sequence. How do I do this? A way of casting a base type to a derived type Why do I have the "required reviews completed" status on my submission in Elsevier? I had submitted my paper in an Elsevier journal one year back. Now, status update on the submission tracking says "Required reviews completed." However, for the last two weeks still there is no change in the status.  Should I ask the editor what is going on with my submission? "Coming soon" pages & SEO What does !function ($) { $(function(){ }) }(window.jQuery) do?