I wanted to plot the density for this data:  hist(res)     As seen the max and min are -1 and 1...  But when I use  plot(density(res))     As it can be seen the density is being plotted for values higher than 1 and lower than -1, why is that? It is as if the density() function works wrong?
470
On the , there is this line:      $p(\mathrm{height}|\mathrm{male}) = 1.5789$ (A probability distribution over 1 is OK. It is the area under the bell curve that is equal to 1.)    How can a value $&gt;1$ be OK? I thought all probability values were expressed in the range $0 \leq p \leq 1$. Furthermore, given that it is possible to have such a value, how is that value obtained in the example shown on the page?
27415
Is $\{n \sin n | n \in \mathbb{N}\}$ dense on the real line?  If so, is $\{n^p \sin n | n \in \mathbb{N}\}$ dense for all $p&gt;0$?  This seems much harder than showing that $\sin n$ is dense on [-1,1], which is easy to show.  EDIT: This seems a bit harder than the following related problem, which might give some insight:  When is $\{n^p [ \sqrt{2} n ] | n \in \mathbb{N}\}$ dense on the real line, where $[\cdot]$ is the fractional part of the expression?  I am thinking that there should be some probabilistic argument for these things.  EDIT 2:  Ok, so plotting a histogram over $n \sin n$ is similar to plotting $n \sin(2\pi X)$ where $X$ is a uniform distribution on $[-1,1].$ This is not surprising, since $n$ mod $2\pi$ is distributed uniformly on  $[0,2\pi].$  Now, the pdf of $\sin(2\pi X)$ is given by $f(x)=\frac{2}{\pi \sqrt{1-x^2}}$ in $(-1,1)$ and 0 outside this set.  The pdf for $n \sin(2\pi X)$ is $g_n(x)=\sum_{k=1}^n \frac{1}{nk} f(x/k)$ so the limit density is what we get when $n \rightarrow \infty.$ (This integrates to 1 over the real line).  Now, it should be straightforward to show that for any interval $[a,b],$ $\int_a^b g_n(x) dx \rightarrow 0$ as $n \rightarrow \infty.$  Thus, the series $g_n$ is "too flat" to be able to accumulate positive probability anywhere. (The gaussian distribution on the other hand, has positive integral on every interval).
83123
I plot tabular data wherein none of the y-values of the data go above 1.0. In the resulting plot, however, there are a couple of peaks that go beyond 1.0, giving a false impression about those data points:   This is not visible when I plot with marks, but I need to use "no marks" because it is otherwise far too busy (80 points in a small plot).   How can I prevent this?  Update: Per Jake's request, here's a minimal example that shows the described behaviour:  \documentclass{article} \usepackage{pgfplots} \begin{document}     \begin{figure}[ht]         \begin{tikzpicture}             \begin{axis}[no markers, grid=major]                 \addplot coordinates{(0, 0.0000000000)                                      (1, 0.8823529412)                                      (2, 0.8750000000)                                       (3, 1.0000000000)                                       (4, 0.8666666667)                                      (80, 0.0000000000)}[thick];             \end{axis}         \end{tikzpicture}     \end{figure} \end{document}   The problem is less pronounced when I don't make my lines thick, but it is still there (and I want thick lines).
65601
I'm working with R since a few months and read the book Discovering Statistics with R by from Andy Field until Chapter 12 by now.  I have some data, which I (for now without any specific reason) want to check for normality.   The data was produced by people filling out a online survey and could check an item on a scale from 1 to 4. So obviously the variable is a discrete one, which is (at least I guess) why I get the strange looking qqplot below. What I don't understand is: My data looks (at least to me) quite like a normal distribution.  The p-value computed by R is still &lt; 0.01 and I don't know why. Is the distribution not normal and everything is right, or is the reason that I only have 4 different values? My sample size is above 70.
93005
Letting $dt$ be an infinitesimal interval, what is the argument to that $$f(t | H_{t_n})\;dt = P (t \in [t,t+dt] | H_{t_n}),$$ where $H_{t_n}$ denotes the history of the previous points before $t$? I know that the probability to be in a certain interval is by integrating the density function over that interval. But why is it in this case equal to the density function times the length of the interval? I've gotten an explanation that it's because we can assume that the density function is constant, as we are considering an infinitesimal interval. However, I can see that the equality then is true if the pdf is constant, but I don't understand why we can assume that the it is constant when considering an infinitesimal interval.
13887
A uniform random number X divides [0, 1] into two segments. Let R be the ratio of the smaller versus the larger segment. How do I compute the density of R?
11508
I am lost in normalizing, could anyone guide me please.  I have a minimum and maximum values, say -23.89 and 7.54990767, respectively.  If I get a value of 5.6878 how can I scale this value on a scale of 0 to 1.
81380
I had this problem from my last question: Given that: $X \sim \text{Uni}(a,b)$. Then why does this say that: $-X \sim \text{Uni}(-a,-b)$ and in general how can I prove such claims? Please show a formal explanation to help me understand every step. My book only has this definition of the density function: $$f_X(x) = \begin{cases} \dfrac{1}{b-a} &amp;x \in [a,b] \\ 0 &amp; \text{otherwise}. \end{cases}$$
119091
Let $X=\min(S,T)$ and $Y=\max(S,T)$ for independent exponential variables $S$ and $T$. Find the joint density of $X$ and $Y$. Are $X$ and $Y$ independent? How would you suggest I approach this?
73989
I am new to 'drawing' in LaTeX with pgfplots, tikz, etc. I am trying to plot a Poisson distribution with varying means. Here is what I have tried (based on )  \documentclass{article} \usepackage{pgfplots} \pgfmathdeclarefunction{poiss}{1}{%   \pgfmathparse{(#1^x)*exp(-#1)/(x!)}% } \begin{document} \begin{figure} \begin{tikzpicture} \begin{axis}[every axis plot post/.append style={   mark=none,domain=0:20,samples=20},   axis x line*=bottom,   axis y line*=left,   enlargelimits=upper]   \addplot {poiss(1)};   \addplot {poiss(2)};   \addplot {poiss(3)}; \end{axis} \end{tikzpicture} \end{figure} \end{document}   What happens next is very strange to me; if I plot this with domain=0:20,samples=20, it looks like the following:    However, if I change domain=0:10,samples=10, it looks like the following:    You can see that the higher mean distributions are 'taller' than they should be, depending on the number of samples; the larger the number samples, the more correct the distributions look but obviously a graph going from 0 to 50 on the x-axis with nothing interesting after 10 is no good!  I'm wondering why is this happening, and how can I fix it? Forgive me if it's something painfully obvious. Thanks.
99864
I have created a mixed distribution model comprising 80% $H_0$ plus 20% $H_1$ to illustrate the link between the expected proportions of true and false positives and negatives in the PDF, CDF and p-value distributions.  When the effect size is small (25% increase in expected correlations vs $H_0$), everything looks consistent:    However, when I increase the effect size to 75% by separating $H_1$ from $H_0$, things don't seem to add up because I get apparent false negatives (grey area) in the p-value distribution, which are no longer there in the PDF and CDF distributions:    Conversely, when I reduce the effect size to 0% (so that $H_1$ = $H_0$), the grey area disappears altogether from the p-value distribution, whereas it is even more prominent in the PDF and CDF distributions:    Now, I'm sure I have done all the maths right and the actual distribution curves are correct and consistent, but perhaps I am misinterpreting the areas between these curves?  What do these four different coloured areas mean in each chart, and how do they relate to the expected proportions of true and false positives and negatives?  How can I show the link between these proportions in the three distributions, and why don't they correspond with each other as shown?  Please help me understand the apparent discrepancy, thanks!
102542
Material density is given by $ \rho =m/V$, where $m$ is mass and $V$ is volume. Again number density given by $n=N/V$, where $N$ is the total number of particle. How can I calculate number density $n$ from material density $ \rho $.
82981
I am programmer developing a Software that features the display of a probability plot. As far as I know there are 2 different ways to display a probability plot (please correct me if I say something wrong):   A Percent / Percent Chart A Quantile / Quantile Chart   My customers want a Percent / Percent Chart. That brings some problems.  There is no charting control I know that features a probability plot chart.    That's why I have to calculate the positions of the data points by hand. Are there any formulas or calculations to place the data points and Y-axis values in a normal coordinate system?
95485
I'm interested in how one can calculate a quantile of a multivariate distribution. In the figures, I have drawn the 5% and 95% quantiles of a given univariate normal distribution (left). For the right multivariate normal distribution, I am imagining that an analog would be an isoline that encircles the base of the density function. Below is an example of my attempt to calculate this using the package mvtnorm - but to no success. I suppose this could be done by calculating a contour of the results of the multivariate density function, but I was wondering if there is another alternative (e.g., analog of qnorm). Thanks for your help.  Example:  mu &lt;- 5 sigma &lt;- 2  vals &lt;- seq(-2,12,,100) ds &lt;- dnorm(vals, mean=mu, sd=sigma)  plot(vals, ds, t="l") qs &lt;- qnorm(c(0.05, 0.95), mean=mu, sd=sigma) abline(v=qs, col=2, lty=2)   #install.packages("mvtnorm") require(mvtnorm) n &lt;- 2 mmu &lt;- rep(mu, n) msigma &lt;- rep(sigma, n) mcov &lt;- diag(msigma^2) mvals &lt;- expand.grid(seq(-2,12,,100), seq(-2,12,,100)) mvds &lt;- dmvnorm(x=mvals, mean=mmu, sigma=mcov)  persp(matrix(mvds,100,100), axes=FALSE) mvqs &lt;- qmvnorm(0.95, mean=mmu, sigma=mcov, tail = "both") #?  #ex. plot    png("tmp.png", width=8, height=4, units="in", res=400) par(mfcol=c(1,2))  #univariate plot(vals, ds, t="l") qs &lt;- qnorm(c(0.05, 0.95), mean=mu, sd=sigma) abline(v=qs, col=2, lty=2)  #multivariate pmat &lt;- persp(seq(-2,12,,100), seq(-2,12,,100), matrix(mvds,100,100), axes=FALSE, shade=TRUE, lty=0) cont &lt;- contourLines(seq(-2,12,,100), seq(-2,12,,100), matrix(mvds,100,100), levels=0.05^2) lines(trans3d(cont[[1]]$x, cont[[1]]$y, cont[[1]]$level, pmat), col=2, lty=2)  dev.off()
91168
What would the graph of $(-1)^{x}$ look like?   I know that the value of the function alternates between $1$ and $-1$ when it is defined so I think it would just be points spread over the lines $x=1$ and $x=-1$.   Is this correct? Also, will there be any definite pattern of the points.
123804
Can you help me with this problem?  Find the center of mass of a lamina whose region R is given by the inequality:   and the density in the point (x,y) is :    The region r is this one:    Is this the proper way to set up the integral for m:  $$\int_{-1}^{1}\int_{-x-1}^{x+1} \ e^{x+y} \ dy \ dx$$  Any help?  Thanks
105822
I know how to use PDFs to calculate probabilities, but I don't think I understand them. For example, at $X=0$ the PDF of the standard normal distribution is $\approx 0.4$. Does this have any useful meaning?