Python: Append lambda functions to list
What do (lambda) function closures capture?
Textbook approach to modeling non-proportional hazards in the Cox model In Cox models with time varying coefficients, the effect of covariates on the hazard is allowed to change through time. In cases where a coefficient has a linear relationship with time, I am aware of at least two text books ( and an Appendix to ) that advocate for the following model, first in R code:  coxph(Surv(time, death) ~ disease + disease:time)   And now in mathematical notation:  $$ h(t|X) = h_0(t) \exp(\beta_1X + \beta_2X_T) $$ Where $h(t|X)$ is the instantaneous hazard rate at time $t$ given covariates $X$; $h_0(t)$ is the baseline hazard rate; and $T$ is the censoring or event times. $\beta_1$ represents the log hazard ratio for individuals with $T=0$ (which is sort of nonsensical since you can't have $T=0$ in the data), while $\beta_2$ is harder to interpret... $\beta_2$ shows how the log hazard ratio depends on censoring/event times, but that is circular because event times are also the response variable (this point is made in Terry Therneau’s vignette “”).  According to Therneau's vignette, to correctly specify a time varying coefficient, you need to use the following model, first in R code:  coxph(Surv(time, death) ~ disease + tt(disease), tt=function(x,t,...){x*t})   And now in mathematical notation: $$ h(t|X) = h_0(t) \exp(\beta_1X + \beta_2X_T) $$  The difference is that the time interaction is with $t$ in the model rather than with the event times $T$ in the data. The resulting parameters are easy to interpret: they are the intercept and slope of the linear relationship between the log hazard ratio of $X$ and time. This approach seems like the proper way to model a time varying effect.  Can anyone justify or advocate for the first approach to modeling non-proportional hazards in the Cox model? If it is really incorrect (as I suspect it is), what are the practical consequences of using this approach? Video produced from images only plays in VLC but no other players Currently using ubuntu 15.10 on azure and installed the gnome and vnc4server latest version on ubuntu. Please find log file below:  Current VNC client screen:    $ cat .vnc/myhost1\:1.log    --cut-- VNCSConnST:  Server default pixel format depth 16 (16bpp) little-endian rgb565 VNCSConnST:  Client pixel format depth 8 (8bpp) colour-map Window manager warning: Invalid WM_TRANSIENT_FOR window 0x20000c specified for    0x20000b (I        nitialization error). Error org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name    'org.gnome.ze        itgeist.Engine': no such name amdxdg-su: no graphical method available for invoking '/usr/bin/amdcccle' as 'root'  $ cat .vnc/xstartup unset SESSION_MANAGER  [ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources  vncconfig -iconic &amp;  gnome-panel &amp; gnome-settings-daemon &amp; metacity &amp; nautilus -n &amp; gnome-terminal &amp;   How to get 24bit color with wide screen (Now I getting square screen in vnc client) How much should a "button of Cure Light Wounds" cost (should it be available at all?) Extended Euclidean Algorithm: backward vs. forward I'm confused about how to do the extended algorithm. For example, here's the gcd part gcd(8000,7001)  $$\begin{align}8000 &amp;= 7001\cdot1 + 999\\ 7001&amp;=999\cdot 7+8\\ 999&amp;=8\cdot 124+7\\ 8&amp;=7\cdot 1+1\\ 7&amp;=1\cdot 7+0\\ \gcd(8000,7001)&amp;=1\end{align}$$    Now, the extended algorithm  $$\begin{align}1 &amp;= 8 - 1\cdot7\\ &amp;= 8 - 1\cdot(999 - 8\cdot124)\\ &amp;= -1\cdot999 + 8\cdot125\end{align}$$  How do you get this 8*125 from the previous line? I'm exploring the effects of removing the intercept in a logistic regression model.  Assume a model:  $$logit(Y = 1) = \beta_1 x + \beta_2z + 0$$  with $x$ and $z$ being categorical variables with 2 levels each and no intercept.  I understood that having no intercept with categorical predictors produce coefficients that compare the $P(Y = 1)$ in each level of the two predictor against a null case where $P(Y=1) = 0.5$ or $logit(Y=1) = 0$.  I noticed a phenomenon that can understand. Using glm() function in R if you change the order of the variable in the right hand part of the formula, the coefficients change too. But even more oddly, the coefficient of the first variable is always the same.  Here's an R demo:  y &lt;- as.factor(sample(rep(1:2), 30, T)) x &lt;- as.factor(sample(rep(1:2), 30, T)) z &lt;- as.factor(sample(rep(1:2), 30, T))  coef(glm(y ~ x + z - 1, binomial) #        x1         x2         z2  #-0.1764783  0.3260739 -0.1335192  coef(glm(y ~ z + x - 1, binomial)) #        z1         z2         x2  #-0.1764783 -0.3099976  0.5025523    As you can see the first predictors have the same coefficient while the other are different in the two models.  Here is what I expected and instead behave differently than what I though:   Since every level of the two predictors is compared to the same null case, I expected to have the same coefficients in the two models, independently from the order in which I use them. I expected to see the coefficients of every level of every predictor, instead the coefficient for the 1 level of the second predictor is not shown. I therefore assume that only the first variable is compared against the null case, while the second is compared against a reference level; but what is this level? Is it $P(Y = 1 | X = 1 \cap Z = 1)$? Reproducing one of the models WITH the intercept we get:  coef(glm(y ~ x + z - 1, binomial) #        x1         x2         z2  #-0.1764783  0.3260739 -0.1335192  coef(glm(y ~ x + z, binomial)) #(Intercept)         x2          z2  #-0.1764783   0.5025523  -0.1335192    As expected x1 become the intercept, and x2 is likely relative to x1. z1 is missing also in this case and z2 is the same as in the model without intercept.  Thus should I assume that the comparison against the null case $P(Y = 1) = 0.5$ is made only for the first variable in a formula, while the other are compared against the usual intercept? Is this behavior normal? What about the fact that the first coefficient has the same value whichever the order of the predictors in the formula? What if I want to compare all level of each predictor against the null case and have a coefficient for all levels? Or it's theoretically impossible for some reason I don't get? Marginal probability derived from joint probability distribution of a poisson process and binomial process I thought I figured out this problem, but my answer is different than the solutions manual. Hoping someone here can stear me in the correct direction:     Assume the number of automobile collisions that occur on a given stretch of highway per year is a Poisson random variable $X$ with $\mu = 20$. The probability is $p=0.05$ that there will be one or more fatalities in each accident; occurrences of fatalities are independent from one collision to the next. If $Y$ is the number of collisions with one or more fatalities on this stretch of road in one year, find the probability law for $Y$.   So as said, X is poisson, so:  $$p_X(x) = \frac{20^x}{x!}e^{-20}$$  The conditional probability of $Y$ given $X=x$ is a Binomial random variable:  $$p_{Y\mid X}(y\mid x) = \binom{x}{y}p^yq^{x-y}$$  where $Y =$ number of fatal traffic accidents and $x =$ given number of accidents (from poisson distribution)  Therefore the joint probability for $X$ and $Y$ is:  $$p_{X,Y}(x,y)= p_{Y\mid X}\cdot p_X(x) = \binom{x}{y}p^yq^{x-y}\frac{20^x}{x!} e^{-20}$$  to find the marginal probability of $Y$, I sum over $P_{X,Y}$ for all $x$:  \begin{align} p_Y(y) &amp; = \sum_{x=y}^\infty{\binom{x}{y}p^yq^{x-y}\frac{20^x}{x!}e^{-20}} = \frac{(20p)^ye^{-20}}{y!} \sum_{x=y}^\infty {20^{x-y}\frac{q^{x-y}}{(x-y)!}} \\[10pt] &amp; = \frac{(20p)^ye^{-20}}{y!} \sum_{x-y=0}^\infty {20^{x-y}\frac{q^{x-y}}{(x-y)!}} = \frac{(20p)^ye^{-20}}{y!}e^{20q} \end{align}  So:   $$p_Y(y) = \frac{(20p)^ye^{-20p}}{y!}$$  however, the correct answer is apparently $p_Y(y)=\dfrac{e^{-1}}{y!}$ Show that the integral of a positive function is positive Is the genderless pronoun "they" appropriate and grammatical for a non-binary gender? I recently had somebody tell me that a mutual friend of ours who is  prefers that people refer to him/her using the gender-indefinite pronoun they.   In some cases, this almost seems okay:   Kris left their umbrella at our house.  On the other hand, if Kris is sitting right next to you, it feels very odd to say       They (meaning just Kris) would like more cake.   Or even odder,      Kris would like some more cake, can you please pass it to they/them?"   Are these usages grammatically correct? Are they in the process of becoming grammatically correct? Are there more correct alternatives? What is the difference between linear regression and logistic regression? What is the difference between linear regression and logistic regression?  When would you use each? I am trying to connect my Galaxy Tab to the Internet through an ad-hoc network made via my PC. The PC ad-hoc settings are fine because I can use it from my iPhone and other devices. Show that $\lim_{x \to +\infty}\left(f(x)+f'(x)\right)=0 \Rightarrow \lim_{x \to +\infty} f(x)=0$ How to show that $\lim_{x \to +\infty}(f(x)+f'(x))=0 $ implies $\lim_{x \to +\infty} f(x)=0$? Is there a way to set transparency of windows in GNOME? How do I get my arrow keys working in the at> prompt Namespaces and Operator Overloading in C++ When authoring a library in a particular namespace, it's often convenient to provide overloaded operators for the classes in that namespace.  It seems (at least with g++) that the overloaded operators can be implemented either in the library's namespace:  namespace Lib { class A { };  A operator+(const A&amp;, const A&amp;); } // namespace Lib   or the global namespace  namespace Lib { class A { }; } // namespace Lib  Lib::A operator+(const Lib::A&amp;, const Lib::A&amp;);   From my testing, they both seem to work fine.  Is there any practical difference between these two options?  Is either approach better? What is the solution to the Squirrel sequence of letters question? Function whose inverse is also its derivative? How to stop HTTPS requests for non-ssl-enabled virtual hosts from going to the first ssl-enabled virtualhost (Apache-SNI) I hope that title is clear.  How do I prevent HTTPS requests for non-ssl-enabled virtual hosts from going to the first ssl-enabled virtualhost (setup is Apache-SNI).  For example, using my abbreviated config below, requests for https://example.com (a non-ssl vhost) are being served by Apache at the ssl-enabled vhost https://example.org. I'd like to disable that behavior and possibly reply with the appropriate HTTP response code (unsure of what that is).  It may not even be possible, but I thought I'd ask.  # I actually have a SNI setup, but it's not demonstrated here. # I don't think it's relevant in this situation.  NameVirtualHost *:80 NameVirtualHost *:443  &lt;VirtualHost *:80&gt;     ServerName example.org &lt;/VirtualHost&gt;  &lt;VirtualHost *:443&gt;     ServerName example.org &lt;/VirtualHost&gt;  &lt;VirtualHost *:80&gt;     ServerName example.com &lt;/VirtualHost&gt;   EDIT: Maybe a mod_rewrite rule in the first ssl-vhost? Is there a limit of $\cos(n!)$? I encountered a problem today to prove that $(X_n)$ with $X_n = \cos(n!)$ does not have a limit (when $n$ approaches infinity). I have no idea how to do it formally. Could someone help? The simpler the proof (by that I mean less complex theorems are used) the better. Thanks Closing Reject Suggested Edit dialogue freezes review process