ML Wiki
Machine Learning Wiki - A collection of ML concepts, algorithms, and resources.

Density Plot

Density Plot

It’s like a Histogram, but smoothed out

With Histogram```

hist(pData$AGEP, breaks=12, col=”red”, prob=T) dens = density(pData$AGEP, adjust=2) lines(dens, col=”blue”, lwd=2)

- <img src="https://raw.githubusercontent.com/alexeygrigorev/wiki-figures/master/crs/da/density-hist.png" alt="Image"> [link](http://stackoverflow.com/q/1497539/861423)


### Without Histogram

dens = density(pData$AGEP) plot(dens, lwd=3, col=”blue”)


- <img src="https://raw.githubusercontent.com/alexeygrigorev/wiki-figures/master/crs/da/density-plots.png" alt="Image">


## Bivariate Analysis
- this plot can also be used with two variables
- <img src="https://raw.githubusercontent.com/alexeygrigorev/wiki-figures/master/crs/da/density-2vars.png" alt="Image">
- it is more convenient than Histograms for doing that 
- since it uses plot, not bars

densM = density(pData$AGEP[which(pData$SEX==1)]) densF = density(pData$AGEP[which(pData$SEX==2)]) plot(densM, lwd=3, col=”blue”) lines(densF, lwd=3, col=”orange”) ```

  • http://en.wikipedia.org/wiki/Density_estimation

Sources