We're a little confused about how R treats the n-roots of negative numbers.
For the inverse of the Weibull, our group came up with
>F^-1 = -B * [log(1-y)]^(1/a)
And we noticed two things about this. First, since y will be pulled
from the uniform distribution, log(1-y) will always be negative. This
means that there is no real solution for any even alpha. Is this a
constraint of the problem.
But, more worrisome, is that I can't seem to get real numbers for odd
alpha's. The code
>log(.2)^(1/3)
also does not return a real result. But you should be able to take a
cube root of a negative number, right???
What am I overlooking?
/\llan
Go Sox!
For more hlep with plots, refer to Zelig, Chapter 5 (which was part of
the reading for this week). In short:
To plot a density:
plot(density(X))
# density(X) returns a list of x and y coordinates
To add a density line to an existing plot:
lines(density(X))
Olivia.
---------- Forwarded message ----------
Date: Wed, 20 Oct 2004 12:56:49 -0700
From: modi(a)fas.harvard.edu
To: olau(a)fas.harvard.edu
Subject: #2 still
Hey Olivia,
Thanks for the help, unfortunately more questions. So a couple R questions
for number 2. If i have a set of single valued data set(i.e. a bunch of
numbers, NOT a bunch of coordinate pairs) and i want to see a plot of
something that looks like its density, what do i do? I have used the
histogram function in the past. Is there a better way to get something
smoother, or a way to increase the number of intervals on the
histogram? Right now, i'm plotting a histogram against the dnorm line of
what you suggested in previous email and can't get them to appear on same
graph, is there a way to do this? Thanks a lot. Amit
Thanks for point this out, Ian. I always get the p* q* and d*
functions confused.
----- Original Message -----
From: "Ian Yohai" <yohai(a)fas.harvard.edu>
To: "'Olivia Lau'" <olau(a)fas.harvard.edu>
Sent: Tuesday, October 19, 2004 11:43 PM
Subject: RE: [gov2001-l] Fw: # 2
> Olivia,
>
> We want the density, no? So wouldn't it be dnorm?
>
> Ian
>
> -----Original Message-----
> From: gov2001-l-bounces(a)lists.fas.harvard.edu
> [mailto:gov2001-l-bounces@lists.fas.harvard.edu] On Behalf Of
> Olivia Lau
> Sent: Tuesday, October 19, 2004 11:29 PM
> To: gov2001
> Subject: [gov2001-l] Fw: # 2
>
> Thanks for asking, Amit.
>
> The gaussian (true) density is the asymtotic normal
> distribution
> given by N(mu, sigma^2/n), as we discussed in section. mu is
> the true population mean, which you know because the Binomial
> distribution is a known density. And sigma^2 is the true
> population variance, which you also know.
> n = (5, 25, 50) (NOT N, the binomial sample size). So now you
> can get the parameters for the normal distribution that you
> want
> to plot.
>
> Now to plot it, you use lines(x, y), where x is your vector of
> x
> coordinates and y is your vector of y coordinates. What's x?
> x
> is just a series of numbers and y is f(x) where f(.) is the R
> function for the Normal distribution function. (It's
> pnorm(...), not f(.), but you get my point.)
>
> In other words, after you figure out what the parameters are,
>
> lines(x, pnorm(x, ...))
>
>
> ----- Original Message -----
> From: <modi(a)fas.harvard.edu>
> To: <olau(a)fas.harvard.edu>
> Sent: Tuesday, October 19, 2004 11:09 PM
> Subject: # 2
>
>
>> Hi Olivia,
>>
>> What's a Gaussian (true) density, and how do i plot it?
>>
>> Thanks,
>> Amit
>>
>
> _______________________________________________
> gov2001-l mailing list
> gov2001-l(a)lists.fas.harvard.edu
> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>
Thanks for asking, Amit.
The gaussian (true) density is the asymtotic normal distribution
given by N(mu, sigma^2/n), as we discussed in section. mu is
the true population mean, which you know because the Binomial
distribution is a known density. And sigma^2 is the true
population variance, which you also know.
n = (5, 25, 50) (NOT N, the binomial sample size). So now you
can get the parameters for the normal distribution that you want
to plot.
Now to plot it, you use lines(x, y), where x is your vector of x
coordinates and y is your vector of y coordinates. What's x? x
is just a series of numbers and y is f(x) where f(.) is the R
function for the Normal distribution function. (It's
pnorm(...), not f(.), but you get my point.)
In other words, after you figure out what the parameters are,
lines(x, pnorm(x, ...))
----- Original Message -----
From: <modi(a)fas.harvard.edu>
To: <olau(a)fas.harvard.edu>
Sent: Tuesday, October 19, 2004 11:09 PM
Subject: # 2
> Hi Olivia,
>
> What's a Gaussian (true) density, and how do i plot it?
>
> Thanks,
> Amit
>
I keep getting asked about my office hours or appointments. as you'll see
more when you all start teaching, the secret of office hours is that they
were not invented to make extra or special time for students; the idea of
office hours is to make it possible to keep students away during all hours
other than the 1-2 that are officially designated. I don't organize things
that way and I'm happy to see you if you need something whenever i'm free.
i'm in my office on most days. if you need to talk with me, come by. if
i'm in a meeting or something, just come back. its usually better and
normally easier to just come by than to try to schedule an appointment
with me (unless you really need a lot of time or absolutely need to make
sure I'm there).
Gary
Hi, all. A revised problem set 4 is up on the course website -- this should
clarify a lot of the questions you had this weekend. The scaled inverse
Chi^2 distribution is on the course web site, under section, 10_14.pdf.
Yours, Olivia
Hello,
I've had trouble getting my R-plots into my Latex documents, and
wondered if anyone could share some wisdom on this. My approach has
been to save the plots out of R as .ps files in the same directory
where my .tex file sits, and then invoke them in the Latex code as
follows:
\begin{center}
\includegraphics[scale=0.8]{plot1n.ps}
\includegraphics[scale=0.8]{plot1pai.ps}
\end{center}
Nothing appears in the dvi, and in fact I think it fails to compile
the rest of the file.
Do the above commands assume that I'm using a particular package? Have
I put the ps files in the wrong place?
I could provide more detail from the latex output if necessary.
Andy Eggers