search for: stat_function

Displaying 9 results from an estimated 9 matches for "stat_function".

Did you mean: startfunction
2011 Nov 10
2
plotting a function with given formula in ggplot2
...and I want to add the regression line to this scatter plot. I suppose I can use geom_smooth() to do this, but for the sake of learning ( I am new both to R and ggplot2), I want to try and add it as a function (something that curve() does in the standard R plotting). I did some search and found that stat_function() can be used for this. But somehow it is not working. The following is my code. Can you please tell me where I am going wrong and what the correct code would be: reg1 <- lm(kid_score ~ mom_hs, data=iqdata) scatter <- ggplot() + geom_point(data=iqdata, aes(x=as.factor(mom_hs), y=kid_scor...
2012 Oct 08
1
weighted cumulative distribution with ggplot2
Dear all, I am trying to draw a weighted cumulative distribution (as defined here http://rss.acs.unt.edu/Rdoc/library/spatstat/html/ewcdf.html) with ggplot2 however the syntax temp<-qplot(X,weight=weight,data=data,stat = "ecdf", geom = "step",colour=factor(year)) seems not to produce exactly the right figure (the values seems higher at some points)... I am wrong in the
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
2018 Apr 16
0
Fwd: Help with R-Calling forth csv.
...[,1]+1), by = 0.5), col="black", fill="green", alpha = .2) + geom_density(col=2) + labs(title="Pressure for r?dmans?") + labs(x="Pressure [kPa]", y="Amount of vehicles (Percentage)")+ stat_function(fun=dnorm, colour="blue", args = list(mean = mean(tryck[,1]), sd = sd(tryck[,1]))) My problem now is to find a statistical distribution that corresponds well with my histograms with the use of Visual aids, cumulative distributions or goodness of fit tests which I can?t develope a code...
2009 Jul 07
1
curve from a formula with ggplot2
Hi all, I'm smoothly transferring my lattice graphs to ggplot2 graphs, but I'm stuck on representing a curve from a formula. I'm looking for the equivalent of curve() in ggplot2, Hadley Wickham mentions geom_curve, but as far as I've seen in the help it doesn't exist. My need is to plot a regular scatter plot of experimental data (easy to do actually) and then add the
2010 Dec 24
0
ggplot2 0.8.9 - Merry Christmas version
...Kohske Takahashi) * pos_stack: now works with NAs in x * scale_alpha: setting limits to a range inside the data now works (thanks to report by Dr Proteome) * scale_colour_continuous: works correctly with single continuous value (fixes #73) * scale_identity: now show legends (fix #119) * stat_function: now works without y values * stat_smooth: draw line if only 2 unique x values, not three as previously * guides: fixed #126 * stat_smooth: once again works if n > 1000 and SE = F (thanks to bug report from Theiry Onkelinx and fix from Kohske Takahashi) * stat_smooth: works with locfit (f...
2010 Dec 24
0
ggplot2 0.8.9 - Merry Christmas version
...Kohske Takahashi) * pos_stack: now works with NAs in x * scale_alpha: setting limits to a range inside the data now works (thanks to report by Dr Proteome) * scale_colour_continuous: works correctly with single continuous value (fixes #73) * scale_identity: now show legends (fix #119) * stat_function: now works without y values * stat_smooth: draw line if only 2 unique x values, not three as previously * guides: fixed #126 * stat_smooth: once again works if n > 1000 and SE = F (thanks to bug report from Theiry Onkelinx and fix from Kohske Takahashi) * stat_smooth: works with locfit (f...
2008 Apr 04
0
ggplot2 - version 0.6
...* stat_bin: now takes origin argument to manually specify origin of first bin (default is round_any(min(range), bin_width, floor)) * stat_boxplot, stat_contour, stat_density2d, stat_qq, stat_density: na.rm parameter added to the following statistics (thanks to Leena Choi for suggesting this) * stat_function: new, makes it easy to superimpose a function on the plot * stat_qq: axes flipped to agree with base R * stat_qq: now uses sample aesthetic to select variable for summary * stat_quantile: updated to work with latest version of quantreg * stat_spoke: new, to make it possible to use geom_segm...
2008 Apr 04
0
ggplot2 - version 0.6
...* stat_bin: now takes origin argument to manually specify origin of first bin (default is round_any(min(range), bin_width, floor)) * stat_boxplot, stat_contour, stat_density2d, stat_qq, stat_density: na.rm parameter added to the following statistics (thanks to Leena Choi for suggesting this) * stat_function: new, makes it easy to superimpose a function on the plot * stat_qq: axes flipped to agree with base R * stat_qq: now uses sample aesthetic to select variable for summary * stat_quantile: updated to work with latest version of quantreg * stat_spoke: new, to make it possible to use geom_segm...