# overlap theoretical density with empiric density

#### ste.gen

##### New Member
I am a neophyte of R, and I am facing the problem to overlap theoretical density with empiric density. The data are extracted from

https://faculty.chicagobooth.edu/-/media/faculty/ruey-s-tsay/teaching/fts3/m-ibm3dx2608.txt

the script in R are:

#1) empiric density:

dim(ibmm)

ibmm[1,]

sibmm=ibmm[,2]

method="kernel", xlab="Rend. mens. sempl. IBM", ylab="densità", col="blue")

#2) theoretical density:
x<- seq(from=-0.261905, to=0.470588, 0.005)

curve(dnorm(x,m=0.0135,sd=0.0715),from=-0.261905,to=0.470588,
xlab="N(0.0135;0.0715^2)", ylab="Densità", main=paste("Normale -
freq. teorica rend. mens IBM: Media=0.0135, Dev.St.=0.0715"),
type="l",lty=2)

Can anyone help me? Thank you. Stefano

#### Attachments

• 9.5 KB Views: 2
• 2.4 KB Views: 2

#### hlsmith

##### Less is more. Stay pure. Stay poor.
So you just want to overlay these? I think in R base plots you just add the word, "add", in the first piece of code.

#### ste.gen

##### New Member
Quando le cose non si sanno è meglio tacere.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
No hable Espanol!

#### GretaGarbo

##### Human
Quando le cose non si sanno è meglio tacere.
"When things are not known it is better to keep quiet."

So @ste.gen you ask a question, then you suggest us to keep quiet!

OK!!!

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Non parlo italiano.