Should I be using R functions such as dbinom and dpois to make my
graph in problem 5 or should I be using handmade functions with
density plots. I am having trouble with the translation of the
simulated results to readable graphs. Particularly, it seems that the
density function for the simulated draws from the binomial
distribution is incorrectly graphed. Any advice?
Sheldon
Just in case anyone would like further information on this subject, if you let
me know privately, I will send you some R code.
Quoting Clayton Nall <nall(a)fas.harvard.edu>:
> By a discrete density function, aren't we talking about a finite vector of
> discrete values and their associated probabilities? The only case where
> this wouldn't be the case for the situation described (for this problem set)
> is with the Poisson random variable, which can take on values over [0,
> infinity). I still don't see how your introduction of the delta and aleph
> terms help us answer the original question.
>
> Sorry for being slow on this subject.
> C
>
>
> On 3/1/06, ghumphr(a)fas.harvard.edu <ghumphr(a)fas.harvard.edu> wrote:
> >
> > As \delta approaches positive infinity, the graph of the average, if
> > plotted,
> > looks more and more like a histogram. \delta cannot ever actually reach
> > infinity without additional definitions, but producing a graph looks that
> > looks
> > like a histogram with \delta < \aleph_0 is possible due to a presentation
> > effect
> > relating to resolution.
> >
> > Quoting Clayton Nall <nall(a)fas.harvard.edu>:
> >
> > > I am still not clear how this relates to plotting a density plot for
> > > discrete values, as the original question asked.
> > >
> > >
> > > On 3/1/06, ghumphr(a)fas.harvard.edu <ghumphr(a)fas.harvard.edu> wrote:
> > > >
> > > > Euclidian distance in this case is on X only; \delta is a
> > parameter. If
> > > > scaled
> > > > by the reciprocal standard errors, the Euclidian distance is, I
> > believe,
> > > > equivalent to the Mahalanobis distance.
> > > >
> > > > \delta=ncol(X)+1 seems to work well. It may be interesting to
> > consider
> > > > \hat{Y}
> > > > as a weghted average of Y weighted by the reciprocal areas, volumes or
> > > > hypervolumes between points, but I have not looked into this area as
> > it
> > > > would
> > > > be good only for quickly producing one-shot estimators where there are
> > few
> > > > data
> > > > points and virtually nothing is known about the data.
> > > >
> > > > Quoting Clayton Nall <nall(a)fas.harvard.edu>:
> > > >
> > > > > Could you explain this in greater detail for the benefit of the
> > list? I
> > > > am
> > > > > not familiar with the way you are using Euclidean distance here, or
> > what
> > > > > delta you are raising this by.
> > > > >
> > > > > Thanks,
> > > > > Clayton
> > > > >
> > > > >
> > > > > On 3/1/06, ghumphr(a)fas.harvard.edu <ghumphr(a)fas.harvard.edu> wrote:
> > > > > >
> > > > > > What you want is a graph of a moving average weighted by Euclidian
> > > > > > distance
> > > > > > raised to power \delta as it approaches positive infinity, or a
> > graph
> > > > of a
> > > > > > k-nearest neighbor plot with k=1.
> > > > > >
> > > > > > Check the first couple of chapters from Fox's book from last
> > semester.
> > > > > >
> > > > > > Geoff
> > > > > >
> > > > > > Quoting Thomas Soehl <thomas_soehl(a)ksg07.harvard.edu>:
> > > > > >
> > > > > > > Hi:
> > > > > > > Is there a way to plot a density function for a discrete
> > variable so
> > > > > > > that it looks like a stepped line. What I mean is If I use plot
> > > > > > > (density(x)) R always interpolates and the thing looks like a
> > > > > > > continuous variable. Is there a way to have it look like a
> > > > histogram?
> > > > > > >
> > > > > > > hope this question makes sense
> > > > > > >
> > > > > > > thanks
> > > > > > > Thomas
> > > > > > > _______________________________________________
> > > > > > > gov2001-l mailing list
> > > > > > > gov2001-l(a)lists.fas.harvard.edu
> > > > > > > http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > gov2001-l mailing list
> > > > > > gov2001-l(a)lists.fas.harvard.edu
> > > > > > http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
>
Hi:
Is there a way to plot a density function for a discrete variable so
that it looks like a stepped line. What I mean is If I use plot
(density(x)) R always interpolates and the thing looks like a
continuous variable. Is there a way to have it look like a histogram?
hope this question makes sense
thanks
Thomas
Is there a command or keystroke for breaking out of a loop in R? I thought a
question had already been posted on this subject but I've misplaced it.
Thanks,
Clayton
Hi Juan,
1) There might be a more straightforward way, but when I do what you want,
I typically use text strings. So...
First, I create the text string that I want:
txt <- paste("E(X)=",mean.3a,sep="")
Then, I feed that text string into the plot command, so for instance
plot(x,y,main=txt)
2) On your second question, I'm just not sure what the default plot format
is. Typically, it is best to specify the format of myplot--so you might
add myplot.eps if it is a postscript file (they work smoothly, and are
generating via R's postscript() function.)
To indicate that myplot.eps is in a subfolder, you should be able to
use the following code:
\includegraphics[scale=.7]{newfolder/myplot.eps}
I am just not sure what constitutes the home directory in this case--does
anyone happen to know?
Best,
Dan
On Tue, 28 Feb 2006 jfvargas(a)fas.harvard.edu wrote:
>
>
> > Hey guys, jus a quick question about plots.
> > This is difficult to explain but I'll try:
> > Suppose I have an element named "mean.3a" and another one "var.3a" with
> > the calculated mean an variance according to the values I gave to alpha
> > and beta in 3a).
> > How do I include these values under the plot without having to write the
> > actual resulting numbers?
> > I tried many things in the lines of:
> > a <- cat("x \n E(x) = ", mean.3a , "\n V(x) = ", var.3a , "\n")
> > plot(........., xlab = a , ylab = ......)
> > Of course this doesn't work, I guess "cat" is not right for this.
> >
> >
> > The other question I had is that you give the following hint in the FAQ
> > about importing R plots into Latex:
> >
> > \begin{figure}[th]
> > \begin{center}
> > \includegraphics[scale=.7]{myplot}
> > \caption{My Plot}
> > \end{center}
> > \end{figure}
> >
> > Is "myplot" in pdf format here? Howdo I extend the above comand to
> > specify the folder/subfolder where I have saved "myplot"?
> >
> > Thanks,
> > Juan
> >
> >
>
>
>
>
Hi all,
Does anyone know the syntax to give names to the rows and columns of either
a matrix or a dataframe?
I'm trying to construct a boxplot for Problem 6 from the (sims x k) matrix
that results, and need names to plug into the X and Y spots for the command
bwplot(X~Y)
Thanks,
--
Jacqueline Chattopadhyay
Ph.D Student, Government & Social Policy
Harvard University
jchattop(a)fas.harvard.edu
jchattop(a)gmail.com
714.313.7022