Dear R-experts,

I am trying to fit a gaussian density curve. More precisely, I would like to 
obtain the fitted "Gaussian curve". 
"m" is the gaussian mean, "sd" is the standard deviation and "k" is an 
arbitrary scaling parameter (since the gaussian density is constrained to 
integrate to 1, whereas my data isn't). 
There is no error message. In my opinion, the last command of my reproducible R 
script is not doing its job !

Many thanks for your lights.

############################################################
a <- as.Date(c("2020-02-25", 
"2020-02-26","2020-02-27","2020-02-28","2020-03-1","2020-03-2","2020-03-3","2020-03-4","2020-03-5","2020-03-6","2020-03-7","2020-03-8","2020-03-9","2020-03-10","2020-03-11","2020-03-12","2020-03-13","2020-03-14","2020-03-15","2020-03-16"))

b<- c(20,28,45,68,89,123,154,190,245,302,460,379,298,300,245,189,165,100,90,78)

d <-as.numeric(a)

m<-11.84

sd<-3.93

k<-359.77

plot(b~d)

plot(function(d) k*exp(-0.5*(d-m)^2/sd^2),col=2,add=TRUE,xlim=range(d))
############################################################
 

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to