Displaying 11 results from an estimated 11 matches for "mydensity".
2008 Jun 17
2
Accessing Max/Min Value of Density Function
Dear all,
Currently I have the following output
> mydensity <- density(x)
> print(mydensity)
x y
Min. : -92.14 Min. :0.000e+00
1st Qu.: 356.66 1st Qu.:5.530e-09
Median : 805.45 Median :4.681e-05
Mean : 805.45 Mean :5.564e-04
3rd Qu.:1254.24 3rd Qu.:3.370e-04
Max. :1703.04 Max. :5.541e-03
How can...
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
...not currently exemplified. I believe this is
an instructive example because it combines the use of lines, arrows,
text, and polygons.
Here's the code:
###Set mu and sigma at your pleasure:
mu <- 10.03
sigma <- 12.5786786
myx <- seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# It is challenging to combine plotmath with values of mu and sigma in
one expression.
# Either bquote or substitute can be used. First use bquote:
myTitle1 <- bquote (paste("x ~ Normal(", mu== .(round(mu,2)), ',',
sigma== .(round(sigma,2))...
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
...rogram?
### Filename: Normal1_2008.R
### Paul Johnson March 31, 2008
### This code should be available somewhere in
http://pj.freefaculty.org. If it is not
### email me <pauljohn at ku.edu>
mymean <- 0
mystd <- 1.5
myx <- seq( mymean - 3*mystd, mymean+ 3*mystd, length.out=500)
myDensity <- dnorm(myx,mean=mymean,sd=mystd)
## This works
plot(myx, myDensity, type="n", xlab="X", ylab="Probability Density ",
main=expression(mu == 0))
## This works
plot(myx, myDensity, type="n", xlab="X", ylab="Probability Density ",
main=e...
2010 Mar 09
3
Shade area under curve
I want to shade the area under the curve of the standard normal density.
Specifically color to the left of -2 and on. How might i go about doing
this?
Thanks
--
View this message in context: http://n4.nabble.com/Shade-area-under-curve-tp1586439p1586439.html
Sent from the R help mailing list archive at Nabble.com.
2008 Dec 31
3
Plotmath with values?
I hope to use the plotmath facility to print titles that mix
math and values of R variables.
The help for "plotmath" has an example, which after repeated
reading, I find baffling. Likewise, I have read the help file
for "substitute" (wqhich seems to be needed) without ever
understanding what it does, other than being used in some magic
incantations.
I would like to do
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and insert
them into an expression
t1t2 <- bquote (paste("Normal(", mu== .(mu), ',', sigma== .(sigma),")") )
plot(myx, myDensity, type="l", xlab="X", yl...
2003 Apr 18
3
superimposing graphs
Dear People,
I have a data set of data x from a probability distribution, and I have a
function, mydensity, of the pdf of that distribution.
I'm asking for help in superimposing the histogram of x and the plot of
mydensity.
In the function below, I call truehist and curve, but these are plotted in
different figures.
I'd like them to be plotted on the same figure, and to use common axes, of
co...
2017 Sep 13
0
ggmap + geom_raster
...geom="polygon", size=0.01, bins=16) +
scale_fill_gradient(low="red", high="green") +
scale_alpha(range = c(0,0.3), guide=FALSE)
The above computes 2d density but it does not take the score (the weight
into account). To do a weighted KDE I do :
library(ks)
mydensity <- kde(x = s_rit[,c(2,3)],w = s_rit$score)
This computes a weighted KDE,but the data can't be passed to geom_raster
because the x,y's are 151 each while the estimated density is a matrix 151
x 151. However this can be accepted by image as shown below.
library(reshape2)
library(ggplot2...
2010 Jul 06
1
plotmath vector problem; full program enclosed
...in advance for your help, sorry if I've made an
obvious mistake or overlooked a manual.
### Filename: plotMathProblem.R
### Paul Johnson July 5, 2010
### email me <pauljohn at ku.edu>
sigma <- 10.0
mu <- 4.0
myx <- seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
### xpd needed to allow writing outside strict box of graph
### Need big bottom margin to add several x axes
par(xpd=TRUE, ps=10, mar=c(18,2,2,2))
plot(myx, myDensity, type="l", xlab="", ylab="Probability Density ",
main=myTi...
2003 May 03
1
can't plot ylab in graph
...,size)
{
x <- empmargdistvec(len,theta,pos,size)
postscript(file="plot.ps", horizontal = FALSE, onefile = FALSE, paper
= "special", width=6, height=4)
par(mfcol=c(1,2),pch=20)
truehist(x, nbins=100,xlab=expression(paste("Range ", (theta))))
mydensityfn <- function(x)
{
mydensity(x,theta,pos,len)
}
par(new=T)
curve(mydensityfn, col = "red", add=TRUE)
...
}
2011 Feb 28
3
re-arranging data to create an image (or heatmap)
Let me start by introducing myself as a biologist with only a little
knowledge about programming in matlab and R. In the past I have succesfully
created my figures in matlab using the hist3d command, but I have not access
to matlab right now and would like to switch to R.
I have used the plot command to create a figure of my data and it does
almost what I want it to do.
My data matrix looks like