similar to: Howto fit normal curve into histogram using GGPLOT2

Displaying 20 results from an estimated 4000 matches similar to: "Howto fit normal curve into histogram using GGPLOT2"

2010 Nov 10
1
par mfrow in "function" problem
Hi all, I defined the following ############################# myhist=function(x){ hist(x,xlab="",main="") h=hist(x) xfit=seq(min(x),max(x),length=100) yfit=dnorm(xfit,mean(x),sd=sd(x)) yfit=yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col="blue", lwd=2) } ############################# individually, it worked fine however, if I used par(mfrow=c(2,2))
2005 Oct 14
1
lattice with predicted values
Dear lattice wizards, I am trying to figure out how to plot predicted values in xyplot, where the intercept, but not the slope, varies among conditioning factor levels. I am sure it involves the groups, but I have been unsuccessful in my search in Pinhiero and Bate, in the help files, or in the archive, or in my attempts on my own. My example follows: FACT is a factor with levels a,b,c
2010 Feb 19
1
"Legend" question
Hi, I want to get a histogram with the legend for my data. I drew a normal density curve and kernel density curve in the histogram, and I also label mean and median in the X axis. From the code, I got two legend: One shows "Normal Density" and "Kernel Density" and their corresponding lines, the other shows "Mean = value" and "Median = value" and their
2007 Jun 07
2
Nonlinear Regression
Hello I followed the example in page 59, chapter 11 of the 'Introduction to R' manual. I entered my own x,y data. I used the least squares. My function has 5 parameters: p[1], p[2], p[3], p[4], p[5]. I plotted the x-y data. Then I used lines(spline(xfit,yfit)) to overlay best curves on the data while changing the parameters. My question is how do I calculate the residual sum of squares.
2001 Oct 13
2
hist and normal curve
Dear R people: I would like to superimpose a normal curve on a histogram. I've seen this example in a book, somewhere. I know that you draw the hist, get the mean and sd of the data set, but then I'm stuck. Could you help, please? Thanks! Erin hodgess at uhddx01.dt.uh.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2007 Oct 01
4
how to plot a graph with different pch
I am trying to plot a graph but the points on the graph should be different symbols and colors. It should represent what is in the legend. I tried using the points command but this does not work. Is there another command in R that would allow me to use different symbols and colors for the points? Thank you kindly. data(mtcars) plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)",
2005 Sep 25
4
hist(x, ...) with normal distribution curve
. I am looking for a histogram or box plot with the adding normal distribution curve I think that must be possible, but I am not able to find out how to do. Regards Knut
2004 Aug 24
0
additional examples for R-intro.texi (PR#7195)
Here are some patches to expand some of the examples in R-intro.texi. -- Brian Gough Network Theory Ltd, Publishing the R Reference Manuals --- http://www.network-theory.co.uk/R/ --- R-intro.texi~ Tue Aug 24 11:21:37 2004 +++ R-intro.texi Tue Aug 24 11:21:37 2004 @@ -6288,6 +6288,21 @@ use @example +> help(package = "@var{name}") +@end example + +A complete list of the
1999 Dec 09
1
nlm() problem or MLE problem?
I am trying to do a MLE fit of the weibull to some data, which I attach. fitweibull<-function() { rt<-scan("r/rt/data2/triam1.dat") rt<-sort(rt) plot(rt,ppoints(rt)) a<-9 b<-.27 fn<-function(p) -sum( log(dweibull(rt,p[1],p[2])) ) cat("starting -log like=",fn(c(a,b)),"\n") out<-nlm(fn,p=c(a,b), hessian=TRUE)
2012 Jul 01
4
geom_boxplot
Also, it is possible to change "ylim" also? 2012/7/1 li li <hannah.hlx@gmail.com> > Dear all, > I have a few questions regarding the boxplot output from the > "geom_boxplot" function. > Attached is the output I get. Below are my questions: > > 1. How can I define the xlab and ylab myself? > Also I would like to remove
2000 Nov 09
2
simple mixture
Dear All, I am trying to do some simple mixture analyses. For instance, I have a sample of n observations and I suspect they come from two different exponential distributions with parameters rate1 and rate2, respectively. So, I want to estimate rate1, rate2, and the proportions of both kinds of individuals in the sample. I had a look at the packages mda and mclust, but they do not seem to do this
2009 Oct 09
1
Substituting the extracted coefficients into the formula, exctracted from the result of nls()
Dear all, Here I come with another stupid question. Suppose I want to use nls() to fit a series of data (here modelled by generated points), then plot the points and the fitting curve. I figured out some way of doing it: x <- runif(1:20, 0, 10) y <- 0.1*x^2 - rep(3, length(x)) + rnorm(length(x), sd = 0.5) yfit <- nls(y ~ a*x^2 + b*x + c, start = list(a = 1, b = 1, c = 1),
2009 Jun 21
2
Help on qpcR package
I am using R on a Windows XP professional platform. The following code is part of a bigger one CODE press=function(y,x){ library(qpcR) models.press=numeric(0) cat("\n") dep=y print(dep) indep=log(x) print(indep) yfit=dep-PRESS(lm(dep~indep))[[2]] cat("\n yfit\n") print(yfit) yfit.orig=yfit presid=y-yfit.orig press=sum(presid^2)
2005 Oct 14
2
Help with lattice, regressions and respective lines
# Dear R list, # # I'm needing help with lattice, regression and respective lines. # My data is below: bra = gl(2, 24, label = c('c', 's')) em = rep(gl(3, 8, label = c('po', 'pov', 'ce')), 2) tem = rep(c(0, 0, 30, 30, 60, 60, 90, 90), 6) tem2 = tem^2 r = rep(1:2, 24) y = c(40.58, 44.85, 32.55, 35.68, 64.86, 51.95, 42.52, 52.21,
2005 Aug 12
6
evaluating string variables
Hello!!! I have a folder (C:/R/) with matrix files, named by number, i.e. 0.mat, 1.mat,...,1250.mat. In this case, they are 5x5 simetric matrices. I would like to compute a property for each matrix and put calculated values into a data frame for posterior ploting and printing. Below there is an example for 7 matrices (0.mat..6.mat) #define data frame L <- data.frame(frame=numeric(7),
2012 Mar 19
9
Efectos fijos y aleatorios en un modelo lineal
Hola a todos, Tengo algunas dudas sobre como introducir en un modelo lineal factores con efectos fijos y aleatorios. Mi diseño es el siguiente: Factores Line: 40 líneas de trigo (Fijo) Rep: 3 Bloques (Aleatorio) Year: 2 Años (Aleatorio) Variable dependiente alpha.ug.mg Nota: Adjunto tabla de datos Dentro del diseño, 'Rep' y 'Year' se considera de efectos aleatorios y
2018 Apr 16
0
Fwd: Help with R-Calling forth csv.
Hi, I do not know how to post in general again, however my csv contains around 5-250k data Points depending on vehicle/road type and pressure exerted on geotechnical structures. I have used R to develope histograms of said csv files and will attach such Picture to you in this mail and the csv used. Below I will type the R code I have used for this histogram.
2010 Jul 29
2
ggplot2 histograms... a subtle error found
Hello all, I have a peculiar and particular bug that I stumbled across with ggplot2. I cannot seem to replicate it with anything other than my specific data set. Here is the problem: - when I try to plot a histogram, allowing for ggplot2 to decide the binwidths itself, I get the following error: - stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
2011 Oct 21
2
Arima Models - Error and jump error
Hi people, I´m trying to development a simple routine to run many Arima models result from some parâmeters combination. My data test have one year and daily level. A part of routine is: for ( d in 0:1 ) { for ( p in 0:3 ) { for ( q in 0:3 ) { for ( sd in 0:1 ) { for ( sp in 0:3 ) { for ( sq in 0:3 ) {
2013 Jun 19
1
nls singular gradient ..as always..
Hi all. Sorry for posting again such a topic but I went through previous posts but couldn't find a solution. I use the following code to fit an exponential model to my data. I have 4 different datasets. For 3 datasets nls seems to work fine and I have no error messages. But for 1 dataset I am getting the "world known" singular gradient error. xfit.dNEE <-