similar to: draw a function over a histogram

Displaying 20 results from an estimated 9000 matches similar to: "draw a function over a histogram"

2008 Jul 25
3
Maximization under constraits
I''m looking for a R function which can maximise this logliklihood function, under the constraits a>0 e b>0 f<-function(param){ a<-param[1] b <-param[2] log(prod)-(a*s2)-(b*s)-n*log(1-((0.5*b/sqrt(a))*(exp((b^2)/(4*a)))*((sqrt(pi ))*(1-pnorm(-b/(2*sqrt(a)), mean=0, sd=1)))))} I''ve tried maxlik constrOptim e donlp2 but without success. Thanks so
2008 Oct 21
5
how to plot the histogram and the curve in the same graph
i want to plot the histogram and the curve in the same graph.if i have a set of data ,i plot the histogram and also want to see what distribution it was.So i want to plot the curve to know what distribution it like. -- View this message in context: http://www.nabble.com/how-to-plot-the-histogram-and-the-curve-in--the-same-graph-tp20082506p20082506.html Sent from the R help mailing list archive at
2010 Jan 03
6
Help with function "fitdistr" in "MASS"
Hi, R users: I want to fit my data into a normal distribution by using the command "fitdistr" in "MASS". I changed my data class from "ts" to "numeric" by >class(mydata)="numeric" but after using "fitdistr", I got the result below >fitdistr(mydata,"normal") mean sd NA NA (NA) (NA) the help doc of
2009 Dec 09
3
Plotting frequency curve over histogram
Hello, This is a problem for which there seem to be several solutions online, but not really. My question was about plotting a curve over the histogram. All the previous posts and messages talk about generating a *density histogram*using (freq=F) and then plotting the density curve. However, I find that that seriously distorts my data and the plot becomes confounding to the viewer. I was
2006 Jun 12
2
Fitting Distributions Directly From a Histogram
Dear All, A simple question: packages like fitdistr should be ideal to analyze samples of data taken from a univariate distribution, but what if rather than the raw data of the observations you are given directly and only a histogram? I was thinking about generating artificially a set of data corresponding to the counts binned in the histogram, but this sounds too cumbersome. Another question is
2004 Mar 01
6
How to plot Histogram with frequence overlaid by distribution curve
Hi, I am facing the problem that I want to plot a histogram chart set freq to true and overlay with normal or weibull or exponential distribution curve. The sample code is shown as below: >samp<-c(-8.2262,-8.2262,-8.2262,-8.20209,-8.09294,-8.07321,-8.07321, -8.07321,-8.07175,-8.04948,-8.04948,-8.04948,-8.03848,-8.03848,
2017 Sep 24
3
Shift the normal curve to the top or near to the top of the histogram
Dear All: One more thing. I want to add the normal curve to the histogram. Is there away to stretch the peak of the curve to the top of the histogram or at least near to the top of the histogram. Please see the code below. Lizard.tail.lengths <- c(6.2, 6.6, 7.1, 7.4, 7.6, 7.9, 8, 8.3, 8.4, 8.5, 8.6,8.8, 8.8, 9.1, 9.2, 9.4, 9.4, 9.7, 9.9, 10.2, 10.4, 10.8,11.3, 11.9) x<-seq(5,12, 0.001)
2009 Sep 02
2
Howto fit normal curve into histogram using GGPLOT2
Currently, I am doing it this way. x <- mtcars$mpg h<-hist(x, breaks=10, col="red", xlab="Miles Per Gallon", main="Histogram with Normal Curve") xfit<-seq(min(x),max(x),length=40) yfit<-dnorm(xfit,mean=mean(x),sd=sd(x)) yfit <- yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col="blue", lwd=2) But since, ggplot2 has more appealing
2009 May 09
2
Histogram frequencies with a normal pdf curve overlay
Dear List, When I plot a histogram with 'freq=FALSE' and overlay the histogram with a normal pdf curve, everything looks as expected, as follows: x <- rnorm(1000) hist(x, freq=FALSE) curve(dnorm(x), add=TRUE, col="blue") What do I need to do if I want to show the frequencies (freq=TRUE) with the same normal pdf overlay, so that the plot would still look the same? Regards,
2007 Mar 08
2
curve of density on histogram
Hi R users, I would like to know why these following curve densities don't appear correctly on the histograms. Thank you for your help library(lattice) library(grid) resp <- rnorm(2000) group <- sample(c("G1", "G2", "G3", "G4"), replace = TRUE, size = 1000) histogram(~ resp | group, col="steelblue", panel = function(x, ...){ std
2005 Apr 05
1
Fitdistr and likelihood
Hi all, I'm using the function "fitdistr" (library MASS) to fit a distribution to given data. What I have to do further, is getting the log-Likelihood-Value from this estimation. Is there any simple possibility to realize it? Regards, Carsten
2017 Sep 25
0
Shift the normal curve to the top or near to the top of the histogram
Hi Abou, Try this: library(plotrix) curve(rescale(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)), c(0,6)),add=TRUE, col=2, lwd = 2) Jim On Mon, Sep 25, 2017 at 9:35 AM, AbouEl-Makarim Aboueissa <abouelmakarim1962 at gmail.com> wrote: > Dear All: > > One more thing. > > I want to add the normal curve to the histogram. Is there away to stretch > the
2012 Jun 27
1
lattice histogram log and non log values
Hello all, Please consider the following library(lattice) Colors. <-rep(brewer.pal(7, "Dark2"),2) color <- 1 Data.X.. <- data.frame(UnitArea = c(rnorm(1000), rnorm(1000)), Type = c(rep("Base",1000),rep("Log",1000))) histogram( ~ UnitArea | Type, data = Data.X.., xlab = "Unit Area", type = "density", panel =
2009 Feb 03
2
Lattice histogram with vertical lines
I would like to add some vertical lines to a lattice plot of histograms. What I am after is a lattice version of abline(v = 1234). The lattice histogram plot is just: histogram( ~ LTSE | approach, data = arrivals) Can anyone point me in the right direction for this? David Scott _________________________________________________________________ David Scott Department of Statistics The
2005 Apr 27
4
Density curve over a histogram
Dear All I would like to draw a picture with the density curve of a normal distribution over a histogram of a set of random numbers extracted from the same normal distribution. Is that possible? Thanks in advance, Paul
2005 Jan 04
1
Non linear Square fit Function
Hi all, I'm trying to use the nls function to do a nls curve fit. I have a histogram for my data. I need to get athe best curve fit for this. i am plotting experimental vs the theoretical values. my experimental values are got from my dnorm function, mean=mean of my mid values(hist) and sd=sd of my mid values. For the theoretical i'm using mean and sd of all 20000 raw values as the start
2005 Sep 20
5
Add function to histogram?
Is there any neat way to add a curve (frequency function or the like) to a histogram or other plots? I haven't found one yet... Robert
2006 Aug 16
3
fitting truncated normal distribution
Hello, I am a new user of R and found the function dtnorm() in the package msm. My problem now is, that it is not possible for me to get the mean and sd out of a sample when I want a left-truncated normal distribution starting at "0". fitdistr(x,dtnorm, start=list(mean=0, sd=1)) returns the error message "Fehler in "[<-"(`*tmp*`, x >= lower & x <= upper,
2011 May 24
1
histogram with density
Hello All,* *I want to draw a histogram with density curve. * *For that simply i created a data called*"x" *and i used the function called * hist(x, col = "blue", freq = FALSE),** *from this function i got a histogram*. *After that , i tried this function* ** lines(density(x), col = "red", lwd = 2 ) *but i could not get the density curve. So, Again i used
2007 Dec 12
1
Overlay PDF on histogram
Hi, I thought that I had read somewhere that there was a really simple way to overlay the probability density function of a normal distribution over a histogram, after the histogram has already been plotted. Possibly a one word command. I've found this email from the archives, but I don't think this is what I'm looking for. I thought there was something more simple than