When and why to use [:] in python
Understanding slice notation
How to model this odd-shaped distribution (almost a reverse-J) My dependent variable shown below doesn't fit any stock distribution that I know of.  Linear regression produces somewhat non-normal, right-skewed residuals that relate to predicted Y in an odd way (2nd plot).  Any suggestions for transformations or other ways to obtain most valid results and best predictive accuracy?  If possible I'd like to avoid clumsy categorizing into, say, 5 values (e.g., 0, lo%, med%, hi%, 1). What are good basic statistics to use for ordinal data? INNER JOIN ON vs WHERE clause 19.10: Deactivate Alt Key From Triggering Applications' Menu Bar How can I stop the Alt key from triggering the menu bar of applications in Ubuntu 19.10?  I know that there are these , , and , as well as  but those solutions are no longer applicable. I did try searching for a similar option to the one in the answer of those questions but with no success. I want to implement the EM algorithm manually and then compare it to the results of the normalmixEM of mixtools package. Of course, I would be happy if they both lead to the same results. The main reference is Geoffrey McLachlan (2000), .  I have a mixture density of two Gaussians, in general form, the log-likelihood is given by (McLachlan page 48):      $$ \log L_c(\Psi) = \sum_{i=1}^g \sum_{j=1}^n z_{ij}\{\log \pi_i + \log f_i(y_i;\theta_i)\}. $$ The $z_{ij}$ are $1$, if the observation was from the $i$th component density, otherwise $0$. The $f_i$ is the density of the normal distribution. The $\pi$ is the mixture proportion, so $\pi_1$ is the probability, that an observation is from the first Gaussian distribution and $\pi_2$ is the probability, that an observation is from the second Gaussian distribution.   The E step is now, calculation of the conditional expectation:      $$ Q(\Psi;\Psi^{(0)}) = E_{\Psi(0)}\{\log L_c(|\Psi)|y\}. $$ which leads, after a few derivations to the result (page 49):      \begin{align} \tau_i(y_j;\Psi^{(k)}) &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{f(y_j;\Psi^{(k)}}  \\[8pt]                        &amp;= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{\sum_{h=1}^g \pi_h^{(k)}f_h(y_j;\theta_h^{(k)})} \end{align} in the case of two Gaussians (page 82):      $$ \tau_i(y_j;\Psi) = \frac{\pi_i \phi(y_j;\mu_i,\Sigma_i)}{\sum_{h=1}^g \pi_h\phi(y_j; \mu_h,\Sigma_h)} $$ The M step is now the maximization of Q (page 49):      $$ Q(\Psi;\Psi^{(k)}) = \sum_{i=1}^g\sum_{j=1}^n\tau_i(y_j;\Psi^{(k)})\{\log \pi_i + \log f_i(y_j;\theta_i)\}. $$ This leads to (in the case of two Gaussians) (page 82):      \begin{align} \mu_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}y_j}{\sum_{j=1}^n \tau_{ij}^{(k)}}  \\[8pt] \Sigma_i^{(k+1)} &amp;= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}(y_j - \mu_i^{(k+1)})(y_j - \mu_i^{(k+1)})^T}{\sum_{j=1}^n \tau_{ij}^{(k)}} \end{align} and we know that (p. 50)      $$ \pi_i^{(k+1)} = \frac{\sum_{j=1}^n \tau_i(y_j;\Psi^{(k)})}{n}\qquad (i = 1, \ldots, g). $$ We repeat the E, M steps until $L(\Psi^{(k+1)})-L(\Psi^{(k)})$ is small.        I tried to write a R code (data can be found ).    # EM algorithm manually # dat is the data  # initial values pi1       &lt;-  0.5 pi2       &lt;-  0.5 mu1       &lt;- -0.01 mu2       &lt;-  0.01 sigma1    &lt;-  0.01 sigma2    &lt;-  0.02 loglik[1] &lt;-  0 loglik[2] &lt;- sum(pi1*(log(pi1) + log(dnorm(dat,mu1,sigma1)))) +               sum(pi2*(log(pi2) + log(dnorm(dat,mu2,sigma2))))  tau1 &lt;- 0 tau2 &lt;- 0 k    &lt;- 1  # loop while(abs(loglik[k+1]-loglik[k]) &gt;= 0.00001) {    # E step   tau1 &lt;- pi1*dnorm(dat,mean=mu1,sd=sigma1)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))   tau2 &lt;- pi2*dnorm(dat,mean=mu2,sd=sigma2)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))    # M step   pi1 &lt;- sum(tau1)/length(dat)   pi2 &lt;- sum(tau2)/length(dat)    mu1 &lt;- sum(tau1*x)/sum(tau1)   mu2 &lt;- sum(tau2*x)/sum(tau2)    sigma1 &lt;- sum(tau1*(x-mu1)^2)/sum(tau1)   sigma2 &lt;- sum(tau2*(x-mu2)^2)/sum(tau2)    loglik[k] &lt;- sum(tau1*(log(pi1) + log(dnorm(x,mu1,sigma1)))) +                 sum(tau2*(log(pi2) + log(dnorm(x,mu2,sigma2))))   k         &lt;- k+1 }   # compare library(mixtools) gm &lt;- normalmixEM(x, k=2, lambda=c(0.5,0.5), mu=c(-0.01,0.01), sigma=c(0.01,0.02)) gm$lambda gm$mu gm$sigma  gm$loglik   The algorithm is not working, since some observations have the likelihood of zero and the log of this is -Inf. Where is my mistake? Can I safely charge my laptop with a non-standard, third-party charger? I have a Toshiba Satellite laptop. My charger has stopped working.  I have access to a Lenovo charger. Can I use this charger on my laptop? I was reading a review of 5e game play  from our RSS Feed. And in it he makes an observation about a strange rule:     Weird rule thing. You recover half your level in hit dice during a   long rest, which means level 1 characters never recover hit dice.   That didn't make sense to me, and so I double checked the long rest rule and it reads:     At the end of a long rest, a character regains all lost it points.   The  character also regains spent Hit Dice, up to a number of dice   equal to half of the character’s total number of them. For example, if   a  character has eight Hit Dice, he or she can regain four spent Hit   Dice upon finishing a long rest.   And of course the rules state that in general you always round down.  Am I missing something? Is there a good explanation for why at first level you can't recover hitdice? Problem with glossary I am copying the very first piece of code from  in order to create a glossary. While I get no problem in the compilation I do not get the "glossary part" that appears in the example. I literally copy paste.  Also, I want to create a document that only consists of a glossary of various terms. That is to put everything in alphabetical order (with the possibility to include references as well). How could I possibly do this? I tried some itemize options with alphabetical order but does not look that good. How to encrypt individual folders? Ethernet Without Magnetics? How / can you connect Ethernet devices together without magnetics? How do you wire it up? What sorts of practical limitations are there on doing this?  To clarify, I'm not trying to connect two computers here. I'm thinking specifically of creating a small network of microcontrollers on a single board. Lets say the total length of a network segment is no longer than 6 inches. This would be for 10BaseT or at most 100BaseT. Badges loading broken in election statistics We have an  and I noticed the badges are not loading in the election statistics like they should be. It just hangs forever loading badge information:    Unfortunately I blew off reporting this for a couple days figuring it would resolve itself, but it doesn't seem to be a temporary problem. How can I take screenshots of YouTube videos in full screen? Why 'Mrs.' isn't read as 'mistress'? Wasn't Mrs. short for mistress? Why do we read Mrs. as missus(or sometimes missis) instead of mistress? Avoiding errors due to unexpanded asterisk In bash I often use for-loops such as the following  for file in *.type; do    sommecommand "$file";  done;   to perform an operation for all files matching *.type. If no file with this ending is found in the working directories the asterisk is not expanded and usually I will get an error message saying that somecommand didn't find the file. I can immediately think of several ways to avoid this error. But adding a conditional does not seem to be very elegant. Is there a short and clean way to achieve this? \AtEveryBibitem{\clearfield{Title}} in beamer? In my beamer presentation, I want to cite the reference without title. So, I tried:  \documentclass{beamer} \usepackage[   backend=bibtex8,   defernumbers=true,   sorting=none,   firstinits=true,   uniquename=init,   uniquelist=false,   refsegment=section,   citestyle=numeric ]{biblatex} \addbibresource{mini.bib} \AtEveryBibitem{\clearfield{Title}} \begin{document} \section{Start} \begin{frame}   first cite\footfullcite{Julie2006}   %\printbibliography \end{frame} \section{2nd} \begin{frame}   Second cite\footfullcite{gyof} \end{frame} \end{document}   with the mini.bib :  @article{gyof,   Author={BLJ},   Title={Some Title},   Journal={joural1},   volume={15},   pages={1337},   Year={1985} } @article{Julie2006,   Author={JBS},   Title={Some Other Title},   Journal={journal2},   volume={74},   pages={144411},   Year={2006} }   with \AtEveryBibitem{\clearfield{Title}} I was expecting no title will be produced, but thats not the case:   Is there any incompatibility between clearfield and footfullcite? Or I am just missing something? Windows 10 ver 1607: File Explorer long paths not working? I updated to the Windows 10 home anniversary edition version 1607 and set LongPathsEnabled to 1 with regedit.exe but the File Explorer doesn't seem to work with long paths still. If you select a long path file and try to rename it, no option will be available. I restarted the computer after making the changes and update.   Is there any way to enable renaming in the File Explorer in the new updated version? Did I miss a step somewhere? We have various ways of invoking apex. Triggers, Inbound Webservices, @InvocableMethod,@RemoteAction and what not. Often we call some or other utility methods from these execution contexts. I have some generic utility method,that should behave differently from the context it is called?  I know about Trigger.isExecuting but it only tells if its running in trigger context or not.  I have a utility method that creates lead from Webservices, VF button click and via Lightning . Whenever we create a lead I want some special operations to be done via the source it was originated.(Its not just updating a simple field leadSource, I have some methods that creates some childs and update other records of other type) . I can achieve this by passing an extra parameter to utility method to tell about source, but i have then to edit hundred of other class that uses this utility method. If i could dynamically find out via which context this piece of code is running,then i would have to change only one class to satisfy my requirement.    Is there something in APEX that tells in what context the apex method was called? I want to describe the variables involved in an equation in an itemized environment such that every item begins with the variable name and subsequently comes the description for it. I'd like to have all the descriptions left aligned.  Here is a MWE that of course does not produce what I am looking for.  \documentclass{standalone} \begin{document} $E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$. % where, % \begin{itemize}     \item $x$      \quad is a continuous random variable.     \item $f_X(x)$ \quad is the PDF of $x$.     \item $g(x)$   \quad is a function of $x$. \end{itemize} \end{document} I moved postgresql's data directory by following the following steps:   Stop postgres cp -a source_data_directory destination_data_directory export PGDATA=destination_data_directory Changing data directory to destination_data_directory within postgresql.conf pg_ctl start   But when I run: "pg_ctl start" I get the following error. Can someone please help me figure out the error.   server starting postgres@Server:/usr/lib/postgresql/9.1/bin$ postgres cannot access the server configuration file "/home/destination_data_directory/postgresql.conf": No such file or directory I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the two examples below it is matching a string that contains all numbers plus an equals sign like "1234=4321". I'm sure there's a way to change this behavior, but as I said, I've never really done much with regular expressions.  string compare = "1234=4321"; Regex regex = new Regex(@"[\d]");  if (regex.IsMatch(compare)) {      //true }  regex = new Regex("[0-9]");  if (regex.IsMatch(compare)) {      //true }   In case it matters, I'm using C# and .NET2.0.