I have a strongly trended series where the trend appears to be exponential and I believe the errors tend to be proportional to the current value. In order to convert it to a stationary series for purposes of forecasting, I expected to do the usual difference in logs transformation. However, it seems that changes have to be really tiny, or else you get a consistent bias strictly from the numerical approximation when it is transformed back into levels. For example, if you have a three percent change from a base of, say, 100, log(103) - log(100) = 0.0295588  (approximately. All calculations done with R.) So 0.029558 would be my dependent variable in this case. To reconstruct the value of the change, take the base, 100, times one plus the estimated change, and subtract the base from the result. 100 * (1 + 0.0295588) = 102.9559 (3 – 2.9559)/3 = 0.0147  Which is to say, a consistent underestimation by about one and a half percent, less for smaller changes, more for bigger ones. Changes in my data are usually smaller than 3 percent, but are that high or higher in about one observation in 210. To me, this seems like a big enough bias to worry about, especially since it is largest when we forecast big changes. Is there a standard correction for this? Or a different way of doing the back-transformation that gives results that are more numerically accurate?
I'm working on a VAR model and am doing a log transformation of the raw data.   x = log(x)   After differencing, running various tests and running a VAR(2) model, I add the predicted differences cumulatively to the original time series (logged) like this:  prd.diffs &lt;- as.ts(prd$mean$d.x1) U &lt;- tail(undiff,2) cumu &lt;- cumsum(prd.diffs) + U[1]   However, while the output now looks as it should, it is still in logged values.  My question is as follows:  How does one return the logged output to original values? I'm under the impression that using exp() will not give the correct results, and having tried some variations it hasn't worked for me.   Does the fact that it is a VAR($p$) model (and possibly what lag it has) influence the method, and how should that be implemented to get the correct output?  P.S. I realise that the above code does not constitute a replicable example as I didn't deem that necessary for the question, but should that be desired I can add some more code.
Is it possible for test error to be lower than training error Is it possible to have test error lower than training error?  I have a classification problem with 2000 samples, 500 of which are positives, 1500 are negatives. I split my data into 70% training data, 30% test data.  Run random forest with 200 estimators and cv=10. I did this several times and compared the recall and precision score and notice the scores for my test set is significantly better. Is this possible? \hfill \break does not work Not sure if there is a cultural difference. In our family it is considered normal to frighten the child so that he behaves the way we want.  Example- Parent: Eat that quickly or the God will punish you! Parent: Don't go on the stairs. The ghost is hiding there and it'll catch you! Parent: Be quiet or the police will grab you!  Does this kind of behavior from the parent's side has any abnormal effects on the baby in the longer run? Can this behavior be accepted as normal?  Has any research been done on this aspect? Does anyone know the (specific) reasons that it is recommended that old LTS server users wait until the point release to upgrade?  Is it just a matter of bug fixes and waiting for improved stability for production servers, or is there something more fundamental than that? Why is gradient the direction of steepest ascent? $$f(x_1,x_2,...x_n):\mathbb{R}^n \rightarrow \mathbb{R}$$ The definition of the gradient is  $$ \frac{\partial f}{\partial x_1}\hat{e}_1 +\  ... +\frac{\partial f}{\partial x_n}\hat{e}_n$$  which is a vector.  Reading this definition makes me consider that each component of the gradient corresponds to the rate of change with respect to my objective function if I go along with the direction $\hat{e}_i$.  But I can't see why this vector (defined by the definition of the gradient) has anything to do with the steepest descent.  Why do I get maximal value again if I move along with the direction of gradient? Prove the identity $\binom{2n+1}{0} + \binom{2n+1}{1} + \cdots + \binom{2n+1}{n} = 4^n$ I've worked out a proof, but I was wondering about alternate, possibly more elegant ways to prove the statement. This is my (hopefully correct) proof:  Starting from the identity $2^m = \sum_{k=0}^m \binom{m}{k}$ (easily derived from the binomial theorem), with $m = 2n$:  $2^{2n} = 4^n = \binom{2n}{0} + \binom{2n}{1} + \cdots + \binom{2n}{2n-1} + \binom{2n}{2n}$  Applying the property $\binom{m}{k} = \binom{m}{m-k}$ to the second half of the list of summands in RHS above:  $4^n = \binom{2n}{0} + \binom{2n}{1} + \cdots + \binom{2n}{n-1} + \binom{2n}{n} + \underbrace{\binom{2n}{n-1} +\cdots \binom{2n}{1} + \binom{2n}{0}}_{\binom{m}{k} = \binom{m}{m-k} \text{ has been applied}}$  Rearranging the above sum by alternately taking terms from the front and end of the summand list in RHS above (and introducing the term $\binom{2n}{-1} = 0$ at the beginning just to make explicit the pattern being developed):  $4^n = (\binom{2n}{-1} + \binom{2n}{0}) + (\binom{2n}{0} + \binom{2n}{1}) + \cdots + (\binom{2n}{n-1} + \binom{2n}{n})$  Finally, using the property $\binom{m}{k} + \binom{m}{k-1} = \binom{m+1}{k}$ on the paired summands, we get the desired result:  $4^n = \binom{2n+1}{0} + \binom{2n+1}{1} + \cdots + \binom{2n+1}{n}$ I need to knock out a quick animation in C#/Windows Forms for a Halloween display.  Just some 2D shapes moving about on a solid background.  Since this is just a quick one-off project I really don't want to install and learn an entire new set of tools for this.  (DirectX dev kits, Silverlight, Flash, etc..)  I also have to install this on multiple computers so anything beyond the basic .Net framework (2.0) would be a pain in the arse.  For tools I've got VS2k8, 25 years of development experience, a wheelbarrow, holocaust cloak, and about 2 days to knock this out.  I haven't done animation since using assembler on my Atari 130XE (hooray for page flipping and player/missile graphics!)  Advice?  Here's some of the things I'd like to know:   I can draw on any empty widget (like a panel) by fiddling with it's OnPaint handler, right?  That's how I'd draw a custom widget.  Is there a better technique than this? Is there a page-flipping technique for this kind of thing in Windows Forms?  I'm not looking for a high frame rate, just as little flicker/drawing as necessary.   Thanks.  Post Mortem Edit ... "a couple of coding days later"  Well, the project is done.  The links below came in handy although a couple of them were 404.  (I wish SO would allow more than one reply to be marked "correct").  The biggest problem I had to overcome was flickering, and a persistent bug when I tried to draw on the form directly.   Using the OnPaint event for the Form: bad idea.  I never got that to work; lots of mysterious errors (stack overflows, or ArgumentNullExceptions).  I wound up using a panel sized to fill the form and that worked fine. Using the OnPaint method is slow anyway.  Somewhere online I read that building the PaintEventArgs was slow, and they weren't kidding.  Lots of flickering went away when I abandoned this.  Skip the OnPaint/Invalidate() and just paint it yourself.  Setting all of the "double buffering" options on the form still left some flicker that had to be fixed.  (And I found conflicting docs that said "set them on the control" and "set them on the form".  Well controls don't have a .SetStyle() method.)  I haven't tested without them, so they might be doing something (this is the form):      this.SetStyle(ControlStyles.UserPaint, true);     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);     this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);    So the workhorse of the code wound up looking like (pf is the panel control):      void PaintPlayField()     {         Bitmap bufl = new Bitmap(pf.Width, pf.Height);         using (Graphics g = Graphics.FromImage(bufl))         {             g.FillRectangle(Brushes.Black, new Rectangle(0, 0, pf.Width, pf.Height));             DrawItems(g);             DrawMoreItems(g);             pf.CreateGraphics().DrawImageUnscaled(bufl, 0, 0);         }     }   And I just called PaintPlayField from the inside of my Timer loop.  No flicker at all. Convert quaternion to a different coordinate system OSVR has a right-handed system: x is right, y is up, z is near.  I need to convert orientation data from a sensor in OSVR to a different right-handed system in which x is forward, y is left, and z is up.  I need to calculate the transformation that will convert a quaternion from one system to the other.  I naively tried:  void osvrPoseCallback(const geometry_msgs::PoseStampedConstPtr &amp;msg) { // osvr to ros     geometry_msgs::PoseStamped outputMsg;      outputMsg.header = msg-&gt;header;     outputMsg.pose.orientation.x = msg-&gt;pose.orientation.y;     outputMsg.pose.orientation.y = msg-&gt;pose.orientation.z;     outputMsg.pose.orientation.z = msg-&gt;pose.orientation.x;     outputMsg.pose.orientation.w = msg-&gt;pose.orientation.w;      osvrPosePub.publish(outputMsg);     ros::spinOnce(); }   But that made things really weird. Facing north pitch is pitch, facing west, pitch is yaw, facing south, pitch is negative pitch...  How can I convert my OSVR quaternion to the a corresponding quaternion in the new coordinate system? Summation of series $\sum_{n=1}^\infty \frac{n^a}{b^n}$? How can we evaluate this series  $$\sum_{n=1}^\infty \frac{n^a}{b^n}?$$  Here $a$ and $b$ are positive integers. If $b=1$ then series will be diverging, in other cases, it will be converging, but how to find this sum?  Isn't there a simple solution which doesn't involve Stirling numbers? Inner product of two continuous maps is continuous Let f,g be continuous maps of S in $\mathbb{R}^n$, to $\mathbb{R}^m$. Show the inner product h(x) = $\langle f(x), g(x)\rangle$ is continuous.  My attempt: Since f,g are continuous, their product is a continuous mapping, so for $\epsilon \gt 0\: t.e\:  \delta \gt 0$ such that $\parallel x - a\parallel \lt \delta $ implies $\parallel \langle f(x),g(x)\rangle - \langle f(a)g(a)\rangle \parallel \le\parallel f(x)g(x) - f(a)g(a)\parallel \lt \epsilon$ by schwartz inequality. How to set HttpResponse timeout for Android in Java I have created the following function for checking the connection status:  private void checkConnectionStatus() {     HttpClient httpClient = new DefaultHttpClient();      try {       String url = "http://xxx.xxx.xxx.xxx:8000/GaitLink/"                    + strSessionString + "/ConnectionStatus";       Log.d("phobos", "performing get " + url);       HttpGet method = new HttpGet(new URI(url));       HttpResponse response = httpClient.execute(method);        if (response != null) {         String result = getResponse(response.getEntity());         ...   When I shut down the server for testing the execution waits a long time at line  HttpResponse response = httpClient.execute(method);   Does anyone know how to set the timeout in order to avoid waiting too long?  Thanks! Infinite metric space has open set $U$ which is infinite and its complement is infinite Let $(X,d)$ be a metric space where $X$ is an infinite set. Prove that the space has an open set $U$ such that both $U$ and its complement are infinite sets.   I have considered if $d$ is the discrete metric, then one such $U$ exists. But if $d$ is not discrete, how do we find such $U$? Meta sites in "Your Communities" display different reputation While using the top bar to navigate across communities, I noticed that the reputation displayed on meta sites on that list does not match the one of their corresponding main sites:    I have noticed on past situations that reputation gained takes a bit to "update" on the display on Meta sites (that is, if you gain rep on SO, for example, it will take some time for you to see your updated rep on MSO).  However, I have never noticed this behavior here, on the Sites List of the top bar. Furthermore, the "delay" here seems to be more severe, as the "outdated" rep showed is of several days ago (for example, I turned 3k on SO almost exactly a week ago, but the rep shown on MSO is still &lt;3k).  Any idea what could be causing this behavior?    Update: 2 months later this persists: my main site rep updates correctly but their corresponding meta rep remains the same as in the image above.     Update: As per Catija's  I removed the site (MSO) and put it back in, but it didn't update the rep.   However, after removing one site (TWP Meta), waiting at least a day, and then adding it back I see that although the reputations still don't match, the number displayed did changed a bit (previously 29,924 but now 33,112): Can we add Markdown support for tables? Terminal appears with much delay when shortcut is used When I press Ctrl+Alt+T the Terminal opens after around 30 seconds. That's pretty annoying. If I open it with Alt+F2 and enter gnome-terminal the window appears instantly as usual.  I'm using Ubuntu 16.04 with gnome3.  Thank you for your help in advance! I want to run a command line that opens a new chrome window with another profile. I tested the following commands: Preconditions:  I have two profiles: Profile 1 and Profile 2  Chrome is already running with Profile 1   open -a &quot;Google Chrome.app&quot; --args --profile-directory=&quot;Profile 2&quot; The above command does nothing other than bringing focus to the currently running chrome with Profile 1 I also tried: open -a &quot;Google Chrome.app&quot; --args --profile-directory=&quot;Profile 2&quot; --new-window The effect is the same. I want to run a command line that opens a new chrome window with Profile 2 while there is already a Chrome window running with Profile 1 Brasero says it won't burn the CD because the file is too big, what's going on? Polite or unrectified placement of the word please This is a Putnam Problem that I have been trying to solve (on and off) for two years, but I have failed. I am in Calculus BC. This problem comes from the book "Calculus Eighth Edition by Larson, Hostetler, and Edwards". This problem is at the end of the first section of the chapter 8 exercises. Here's the problem:  Evaluate $$\int_2^4 \frac{\sqrt{\ln(9-x)}\,dx}{\sqrt{\ln(9-x)} + \sqrt{\ln(x+3)}}.$$  Please. Any help is very much appreciated. So are solutions. Thank you!  Edit: I like the solution given, but I was interested to see if there is any other way of doing the problem? I'm excited to see the results. Delete all files except files with the extension pdf in a directory