I'd like to create a reference sheet of common distributions for my statistical theory class, but I'm having some issues understanding R's implementation of the negative binomial distribution in the stats package. Here's the code I've been using to visualize the distribution.  ggplot(data.frame(x=c(0:30)), aes(x)) + stat_function(geom="point", n=16, fun=dnbinom,                 # Arguments to pass to dnbinom()               args = c(p = 0.2, size = 2))   By my understanding of the NBD, p = 0.2 should be the probability of success (or failure, depending on your framing), and size = 2 should be the number of successes we are looking to observe. However, the output of the plot is .  I'm having trouble understanding how it's possible to have any probability mass at 0, before we've run any trials at all. I've read the documentation for dnbinom(), but I'm still not sure why this is the result, and the docs don't offer details on the exact equation that was implemented, or a sufficiently basic example that would show how the function works. Any advice/input would be much appreciated. Thanks!
I was trying to fit my data into various models and figured out that the fitdistr function from library MASS of R gives me Negative Binomial as the best-fit. Now from the  page, the definition is given as:     NegBin(r,p) distribution describes the probability of k failures and r   successes in k+r Bernoulli(p) trials   with success on the last trial.   Using R to perform model fitting gives me two parameters mean and dispersion parameter. I am not understanding how to interpret these because I cannot see these parameters on the wiki page. All I can see is the following formula:    where k is the number of observations and r=0...n. Now how do I relate these with the parameters given by R? The help file does not provide much information either.   Also, just to say a few words about my experiment: In a social experiment that I was conducting, I was trying to count the number of people each user contacted in a period of 10 days. The population size was 100 for the experiment.   Now, if the model fits the Negative Binomial, I can blindly say that it follows that distribution but I really want to understand the intuitive meaning behind this. What does it mean to say that the number of people contacted by my test subjects follows a negative binomial distribution? Can someone please help clarify this?
error: file '/grub/i386-pc/normal.mod' not found. grub rescue&gt;   What can I do? I just sit and stare at it.   I found my old netbook (Dell Inspiron 1010) which I have not used for about four years. I replaced Windows XP with Ubuntu 12.10. I used my bootable USB drive. I installed and rebooted. I got the message that normal.mod is not found.   What should I do? Type exit, reboot, or quit? Should I re-install? Will my software work on the next version of Windows I have some software and I'd like to know if it works on the next version of Windows (Windows 10). Position of adverbs I am bit confused when it comes to the positioning of adverbs determinations in a sentence.   I was told that you can place them almost everywhere like in:     To be a teacher not only means to teach a language...   &nbsp;     To be a teacher means not only to teach a language   Placing adverbs at the beginning or the end of the sentence is not a big problem, as far as I know, but what about the rest.   Are there rules for all this or can you place them anywhere including normal adverbs like "passionately" etc.? How can I use an align environment flush left? Is there a way possible to imitate the align environment for math mode commands, without having all writing being placed toward the center on the output page?  MWE:  \documentclass{article} \usepackage{mathtools}  \begin{document} \begin{align*} \cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &amp;= \cos(\theta_1 +\theta_2) \\ \sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &amp;= \sin(\theta_1+\theta_2) \end{align*}  \end{document} Fix half-installed package I am getting error while using sudo apt-get upgrade stating:  dpkg: error processing libgfortran3:amd64 (--configure):   package libgfortran3:amd64 is not ready for configuration   cannot configure (current status `half-installed') Errors were encountered while processing:   libgfortran3:amd64 E: Sub-process /usr/bin/dpkg returned an error code (1)   It does not seem to block the installation/upgrade other applications. I believe this problem arose due to direct shutting down of my PC while the application was being upgraded.  How can I fix this? Prove that $\phi(n) \geq \sqrt{n}/2$ So I'm trying to prove the following two inequalities: $$\frac{\sqrt{n}}{2} \leq \phi(n) \leq n.$$ The upper bound we get from simply noting that $\phi(n) = n \prod_{p | n}\left( 1 - \frac{1}{p}\right)$ and the fact that $(1 - \frac{1}{p}) \leq 1$. But how can we get the lower bound? I tried using the same expression for $\phi(n)$ but it seems to not really give me the inequality. Can you help? Why can't I find any manpages? I'm working on a Power8 server running Ubuntu 16.04.2 LTS:  $ uname -a     Linux power 4.4.0-75-generic #96-Ubuntu SMP Thu Apr 20 09:55:30 UTC 2017 ppc64le ppc64le ppc64le GNU/Linux  $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"   None of the usual manpages appear to be installed. Even a simple command like:  man man   returns   No manual entry for man See 'man 7 undocumented' for help when manual pages are not available.   This goes for a variety of other tools, like ls, grep, etc. and library functions like usleep, printf, and so on.  I've checked that at least some manpages are actually installed:  $ dpkg -l | grep -i manpages ii  manpages                           4.04-2                                     all          Manual pages about using a GNU/Linux system ii  manpages-dev                       4.04-2                                     all          Manual pages about using GNU/Linux for development ii  manpages-posix                     2013a-1                                    all          Manual pages about using POSIX system ii  manpages-posix-dev                 2013a-1                                    all          Manual pages about using a POSIX system for development   Am I missing something? Is this specific to the ppc64le architecture? Or is there something else I can/should install to access these manpages?  Update: As requested, I ran sudo mandb. The result was:  0 man subdirectories contained newer manual pages. 0 manual pages were added. 0 stray cats were added. 2 old database entries were purged.   There were no changes to man man and other such commands.  Additionally, the output of manpath was:  $ manpath -g /usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man:/usr/X11R6/man:/opt/man $ manpath -c /var/cache/man/oldlocal:/var/cache/man/local:/var/cache/man Drawing wavy, wiggly lines in QGIS? Is there a QGIS function or plugin to draw wiggly line?   I have used Spline Tool to manually draw some waves, but it is time consuming.  If possible, I would like to draw something like:    Inkscape Function Plotter ( sin(x) curve). Sort arrays of primitive types in descending order I've got a large array of primitive types (double). How do I sort the elements in descending order?  Unfortunately the Java API doesn't support sorting of primitive types with a Comparator.  The first approach that probably comes to mind is to convert it to a list of objects (boxing):  double[] array = new double[1048576];     Arrays.stream(array).boxed().sorted(Collections.reverseOrder())…   However, boxing each primitive in the array is too slow and causes a lot of GC pressure!  Another approach would be to sort and then reverse:  double[] array = new double[1048576]; ... Arrays.sort(array); // reverse the array for (int i = 0; i &lt; array.length / 2; i++) {      // swap the elements      double temp = array[i];      array[i] = array[array.length - (i + 1)];      array[array.length - (i + 1)] = temp; }   This approach is also slow - particularly if the array is already sorted quite well.  What's a better alternative? I am  new to Linux. I am using Ubuntu 11.04 and do not know how to compile and execute C++ program in it. I need to know the commands to Compile and Execute a C++ program in Linux. Why does println(array) have strange output? ("[Ljava.lang.String;@3e25a5") When is the graph of the divisor relation on $[n]$ planar? A recently-deleted question asked to show that if $G(n)$ is the graph on $[n]=\{1,\dots,n\}$ where $x$ and $y$ are adjacent if $x|y$ or $y|x$, then $G(n)$ is planar.  This is false if $n\geq150$, for the subgraph induced by $\{2,3,5,90,120,150\}$ is isomorphic to $K_{3,3}$.  My question is, what is the largest value of $n$ such that $G(n)$ is planar?  Of course, various software packages would make short work of this, but I'd be interested in a verbal argument, if someone can give one. How does "Reputation" work? In a  a doubt was voiced about my answer, which claims GCM to requires $2^{128}$ for a successful forgery. The doubt was that the square root needs to be taken meaning the security would be $2^{64}$.  So of course I immediately checked the relevant security theorem ():  $$\mathbf{Adv}^{\text{auth}}_{\operatorname{GCM}[\operatorname{Perm}(n),\tau]}(\mathcal A)\leq \frac{0.5(\sigma+q+q'+1)^2}{2^n}+\frac{q'(\ell_A+1)}{2^\tau}$$  with $\sigma$ being the total plaintext size in blocks, $q$ being the total number of encryption queries, $q'$ being the total number of decryption queries, $n$ being the size in bits of the underlying permutation, $\ell_A$ being maximum authenticated input length in blocks and $\tau$ being the tag size in bits.  Now clearly from this we can see that performing $2^{n/2}=2^{64}$ queries yields a strong enough advantage for a break.  Now my question is: When talking about "n-bits of security" or "needs $2^n$ operations to break", do we usually talk about "online" security, ie queries to an oracle can be done and cost $1$ or "offline" security where no oracles are available or do we need to make this decision depending on the situation?  TL;DR: Does GCM offer 64 or 128 bit security? To find all $n$ such that $(n-1)!+1$ is a perfect power of $n$ If you provide 0 as the dayValue in Date.setFullYear you get the last day of the previous month:  d = new Date(); d.setFullYear(2008, 11, 0); //  Sun Nov 30 2008   There is reference to this behaviour at . Is this a reliable cross-browser feature or should I look at alternative methods? How to send emails and avoid them being classified as spam? This is a  about how to handle email sent from your server being misclassified as spam.  For additional information you may find these similar questions helpful:                    Sometimes I want to send newsletters to my customers. The problem is, that some of the emails get caught as spam messages. Mostly by Outlook at the client (even in my own Outlook 2007).  Now I want to know what should be done to create "good" emails. I know about reverse lookup etc., but (for example), what about a unsubscribe link with an unique ID?  Does that increase a spam rating? Google Maps choose zoom to fit country TIGHTLY in given window Let $C$ be the coefficient of $x^2$ in the expansion of the product $(1 - x)(1 + 2x)(1 - 3x)\cdots(1 + 14x)(1 - 15x).$ Find $|C|.$   Just to begin,  $(1-x)(1+2x) = -2x^2 + x + 1$  $(1-x)(1+2x)(1-3x) = 6x^3 - 5x^2 - 2x + 1$   But expanding on like this take too long.  In the end the terms will be like:  $(1 - 15x)(a_0 + a_1x^1 + a_2x^2 + ....)$  Then just looking at the $x^2$, it will be:  $(a_2x^2 - 15a_1x^2) = x^2(a_2 - 15a_1)$  But it it still a very hard problem, any hints? Swapping two variable value without using third variable