Sorry for possible format problems, it's my first time in this kind of community sites.
I'm looking for an alternative code that doesn't use density() for this:
datos<-c(1.7, 2.1, 3.1, 3.3, 3.7, 4.1, 4.6)
u<-runif(1000)
z1<-1*(u<=1/6)
z2<-1*(u<=(2/6)&(u>(1/6)))
z3<-1*(u<=(3/6)&(u>(2/6)))
z4<-1*(u<=(4/6)&(u>(3/6)))
z5<-1*(u<=(5/6)&(u>(4/6)))
z6<-1*(u>(5/6))
x<-z1*rnorm(1000,datos[1],0.6)+z2*rnorm(1000,datos[2],0.6)+z3*rnorm(1000,datos[3],0.6)+z4*rnorm(1000,datos[4],0.6)+z5*rnorm(1000,datos[5],0.6)+z6*rnorm(1000,datos[6],0.6)
h <- bw.ucv(x)
f <- density(x,bw=h,kernel="gaussian",from=-1,to=6,n=1024)
plot(f,main='',ylim=c(0,0.7))
It is meant to do the kernel density estimator of the sum of the normal distributions with means saved in datos and sd=0.6.
My problem is not fully statistical but more about finding the line/s that can substitute density().
Thank you.