I'm looking for an analytical expression for the expected value of the latent utility in a logistic regression.  Setup:  There are two choices indexed by $i \in \{0, 1\}$ with associated utilities $u_i = w_i + \epsilon_i$, with the $\epsilon_i$ i.i.d. Gumbel(0, 1), aka Type I Extreme Value with location 0 and scale 1. The $w_i$ are constants.  (Same setup as )  Let $Z \equiv \max\{u_0, u_1\}$, i.e. $Z$ is the utility you get when choosing the preferred alternative.  Question:  Is there a closed-form expression for the expected value of $Z$? If so, what is it, and how is it derived?  Additional Info:  If you know the answer, skip this section :-)  The $\epsilon_i$ have CDF $F(x) = e^{-e^{-x}}$ and expected value $\gamma \approx 0.5772$, the Euler–Mascheroni constant -- here I'm copying from , in case this is helpful to anyone reading this question.  I did some googling, and I found something saying $\mathbb{E}[Z] = \ln(\Sigma_i(e^{w_i})) +$ constant. Is this correct?  I wrote some R code to investigate, and it seems like $\mathbb{E}[Z] = \ln(\Sigma_i(e^{w_i})) + \gamma \approx \ln(\Sigma_i(e^{w_i})) + 0.5772$. Is this correct?  Here's the code:  # Binary choice # w_i + \epsilon_i with \epsilon_i ~ Gumbel # Is Emax{w_i + \epsilon_i} = log(sum(exp(w_i))) + \gamma?  rgumbel &lt;- function(n) {   # Slower than Runuran, but avoids installing a new package   u &lt;- runif(n)   return(-log(-log(u))) } library(Runuran)  # Gumbel rgumbel &lt;- function(n) {   distribution &lt;- udgumbel()   generator &lt;- pinvd.new(distribution)   return(ur(generator, n)) }  gamma &lt;- 0.57722 # Euler–Mascheroni constant GetError &lt;- function(w=c(5, 10), n=100000) {   epsilon &lt;- matrix(nrow=n, ncol=2, data=rgumbel(2*n))   utility &lt;- pmax(epsilon[, 1] + w[1],                   epsilon[, 2] + w[2])   emax &lt;- mean(utility)   emax.analytical &lt;- log(sum(exp(w))) + gamma  # Correct?   return(emax - emax.analytical) }   The GetError function returns the difference between a sample mean and my candidate analytical expression. I played around and tended to see values very close to zero.  Here's my very feeble attempt at getting an analytical expression for $\mathbb{E}[Z]$:  $G(z) \equiv Pr[Z \leq z] = Pr[w_0 + \epsilon_0 \leq z] Pr[w_1 + \epsilon_1 \leq z | w_0 + \epsilon_0 \leq z]$  $G(z) = F(z - w_0) F(z - w_1) = e ^ {-e^{-z + w_0} -e^{-z + w_1}}$  $g(z) \equiv G^\prime(z) = e ^ {-e^{-z + w_0} -e^{-z + w_1}} (e^{-z + w_0} + e^{-z + w_1})$  $\mathbb{E}[Z] = \int z g(z) dz$  So, assuming there are no mistakes up to here, I need to calculate:  $\int z e ^ {-e^{-z + w_0} -e^{-z + w_1}} e^{-z + w_0} dz$ plus a similar second term, but I'm not sure how to deal with this integral.  Many thanks for any help,  Adrian
I keep reading in economics journals about a particular result used in random utility models. One version of the result is: if $\epsilon_i \sim_{iid}, $ Gumbel($\mu, 1), \forall i$, then:   $$E[\max_i(\delta_i + \epsilon_i)] = \mu + \gamma + \ln\left(\sum_i \exp\left\{\delta_i \right\} \right),  $$  where $\gamma \approx 0.52277$ is the Euler-Mascheroni constant.  I've checked that this makes sense using R, and it does.  The CDF for the Gumbel$(\mu, 1)$ distribution is:  $$G(\epsilon_i) = \exp(-\exp(-(\epsilon_i - \mu)))$$  I'm trying to find a proof of this and I've had no success.  I've tried to prove it myself but I can't get past a particular step.   Can anyone point me to a proof of this?  If not, maybe I can post my attempted proof up to where I get stuck.
The equivalence of open-set definition of continuous mappings to the $\epsilon-\delta$ definition A function $f: M\rightarrow N$ is defined to be continuous iff $\forall$ open set $U\subseteq N$, the preimage of $U$ is also open.  I was trying to prove that such a definition would be equivalent to the $\epsilon -\delta$ definition in a metric space, and I could only do so if I assume $f$ is surjective, or otherwise a counterexample would be $g: \mathbb{R}\rightarrow\mathbb{R}$ where $g(x)=x^2$. As if I take $U=(-1,1)$, then its preimage is $[0,1)$, which is neither open or closed. In fact, any $U$ containing elements that cannot be achieved by $g$ would face the same problem.  So I was wondering that have I remembered the definition of preimage wrong, or do I need to make sure that $U$ must be chosen from the image set of $f$? Let $\{a_n\}$ be an unbounded, strictly increasing sequence of positive real numbers and let $x_k=\frac{a_{k+1}-a_{k}}{a_{k+1}}$. Which of the following statements is/are correct? (CSIR NET December 2014)         For all $n\geq m, \sum\limits^{n}_{k=m}x_k&gt;1-\bf{\frac{a_m}{a_n}}$   There exist $n\geq m, \sum\limits^{n}_{k=m}x_k&gt;\frac{1}{2}$      My attempt:  Analysing question in light of $a_k=k\implies x_k=\frac{k+1-k}{k+1}=\frac1{k+1}$, I feel both are correct, I doubt if  I can generalise the result in light of this one example.   Any way to prove that this true for general case?    Note: Please do not confuse  with my question. The first two options are different, I've marked the difference in bold. interior points and limit points of $\{(x,y): x^2+2y^2 < 1\}$ Find out all interior points and limit points of $ A =\{(x,y): x^2+2y^2 &lt; 1\}$  I understand this problem graphically, but i'm not quite sure how to prove the answer rigorously using mathematical word.  My try : Let k be an element of A, and suppose t is an element of $\{(x,y):x^2+2y^2 =1\}$, which makes minimum $||t-k||$. Then $N(k,\delta)\subset A$ when $\delta = \||t-k||$.  I suppose this will work, but I want more clear and detailed proof.  Thank you in advance. Describe in English a Turing machine that semidecides the following language - Is this solution correct? The language being L, which is described as follows:  $L$ = { $&lt;M&gt;$ | $M$ accepts the binary encodings of at least 4 odd numbers } .  My solution:  M generates the binary encodings in $\Sigma_M*$ in ascending order and uses dovetailing to interleave the computation of M on those binary encodings. As soon as four computations accept, M halts and accepts.  Is this correct? What corrections would have to be made if not? I am not sure if I am providing enough details in my solution which may cause it to be incorrect. How can I merge properties of two JavaScript objects dynamically? I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects. How to create batch file in Windows using "start" with a path and command with spaces I need to create a batch file which starts multiple console applications in a Windows .cmd file.  This can be done using the start command.  However, the command has a path in it.  I also need to pass paramaters which have spaces as well.  How to do this?  E.g. batch file  start "c:\path with spaces\app.exe" param1 "param with spaces" In the inline math mode ($...$), if the formula is too long, LaTeX will try to break it on operators, e.g.  very long text followed by a very long equation like $a+b+c+d+e+f+g+h+i+j+k+l$ etc   may be rendered as  very long text followed by a very long equation like a+b+c+d+e+f+g+h+i+ j+k+l etc   However, the break won't happen if they are separated by commas, e.g.  very long text followed by a very long equation like $a,b,c,d,e,f,g,h,i,j,k,l$ etc   will overflow the page like  very long text followed by a very long equation like a,b,c,d,e,f,g,h,i,j,k,l etc   How to make LaTeX able to insert line breaks after a comma too? How do I set up a Cron job? Should reputation points expire? While looking at the SO question  It occurred to me that this was an extremely simple question with an extremely simple answer.  And yet, it has garnered the OP thousands in upvote points, simply because he was the first one to ask this question in the early days of SO.  There are many examples of these simple questions and I believe they don't accurately model a user's participation in the SO community.  People shouldn't be getting thousands or even tens of thousands of points from a question just because they were lucky enough to get it in the system a while ago.  Another related issue is that the non-expiring point system rewards users for seniority.  Simply put, the longer you're around SO, the higher your score will be.  While there's some merit to this, it seems to have a disproportionate effect.  So what can we do to limit these effects?  I'm just brainstorming but here are a couple ideas:   Automatically close voting on questions after a certain time period.  Good questions will still be rewarded, but they won't give disproportionately large rewards simply because they are really old questions. Expire users' points after a certain time period.  If you expire users' points after, say 3 months, then this will force them to stay active and their points will be more a reflection of "How much have you participated lately"?  It forces old users to stay active rather than resting on their laurels, and allows junior members a chance to catch up to senior members of the community by putting in a lot of effort.  Currently, there is no chance at all for junior members to ever catch up with senior members and their only 'sin' is that they didn't register 5 years ago. align xticks in PGFPlots Format a date in XML via XSLT What are the complexity guarantees of the standard containers? Prove: If $a\mid m$ and $b\mid m$ and $\gcd(a,b)=1$ then $ab\mid m$ avoid space after commas used as thousands separator in math mode I'm a computer student, learning math just for fun. Today I was  that I found something strange! I noticed that that wired function ${x^{x^{\cdot^{\cdot^{x}}}}}$ in zero, seems to converge to 1 when there are even powers and to 0 when there are odd powers! Then I attempt to prove it but I failed.  Then I did a little research and I found the  article on Wikipedia. This article says that my guess was right but without any proof. So I'm here to ask you about it.     If we define ${x^{x^{\cdot^{\cdot^{x}}}}}$ as ${^{n}x} :=\begin{cases} 1 &amp;\text{if }n=0 \\ x^{\left(^{(n-1)}x\right)} &amp;\text{if }n&gt;0 \end{cases}$      then prove:      $$\lim_{x\rightarrow0} {}^{n}x = \begin{cases}   1, &amp; n \text{ even} \\  0, &amp; n \text{ odd} \end{cases}$$ How can I control the name of generic WCF return types? I've got a WCF Web Service method whose prototype is:  [OperationContract] Response&lt;List&lt;Customer&gt;&gt; GetCustomers();   When I add the service reference to a client, Visual Studio (2005) creates a type called "ResponseOfArrayOfCustomerrleXg3IC" that is a wrapper for "Response&lt;List&lt;Customer>>".  Is there any way I can control the wrapper name?  ResponseOfArrayOfCustomerrleXg3IC doesn't sound very appealing... I am having a problem understanding displacement maps. I'm starting to think that I don't understand them at all.  Clarifying My Understanding  My understanding (which might be completely wrong), is that a displacement map is a gray-scale image whereby a value of 0.5 produces no displacement, >0.5 produces displacement in the positive direction, and &lt;0.5 produces displacement in the negative direction. This, however, does not seem to match my actual observations in Blender.  I am using a displacement map within Cycles, plugging it into the Displacement socket on the Material Output node (I am also using the new experimental adaptive subdivision and micro-vertex displacement). I note that a value of 0.5 actually produces a displacement in the positive direction, causing the whole mesh to jump up slightly, as well as creating the peaks and valleys that you would expect for >0.5 and &lt;0.5 values respectively.  This affects my entire understanding of displacement maps. Why is this happening? Why is a value of exactly 0.5 creating displacement? Further, how are you supposed to arrange and line up objects in your scene when, in rendered view, the displacement maps will push them out of position, even if those maps are only supposed to create displacement in specific areas.  The Problem in Practice  This is the problem I am having at the moment. I have a plane which is supposed to be a snowy field, and I am using a displacement map to give some depth to the snow. In rendered view, my plane jumps up significantly. This is what lead me to investigate my understanding of displacement maps, and to this question.  Additionally, what is the correct way to increase and decrease the strength of a displacement map? At the moment, I will run them through a Math node set to multiply, however, as you might imagine, this exaggerates the issue that I am complaining about above.  To be clear, however, I am not using a math node when experiencing the "jump up" for 0.5 values. This is not the source of my problem, but another aspect to it. Show $\sum\limits_{n=0}^{\infty}{2n \choose n}x^n=(1-4x)^{-1/2}$ How do you prove that $\sum\limits_{n=0}^{\infty}{2n \choose n}x^n=(1-4x)^{-1/2}$? I tried to identify the sum as a binomial series, but the $4$ and the $-1/2$ puzzle me. (This series arises in studying the first passage time of a simple random walk.) iOS: Your passcode is required to enable Touch ID Can I see why a package is installed?