I am trying to plot two different measures of financial risk (strongly simplified, don't take it seriously). My intention is to plot both and add some label or legend to clarify the graph.
require(ggplot2)
library(reshape)
alpha <- 0
x <- c()
var <- c()
es <- c()
for (i in 1:999) {
alpha <- alpha + 1/1000
x[i] <- i/1000
var[i] <- qnorm(alpha, mean=0)
es[i] <- dnorm(qnorm(alpha))/(1-alpha)
}
df <- data.frame(x,var,es)
df <- melt(df,id=x)
ggplot(df) + geom_line(aes(x=, y=value)) + scale_colour_manual(values=c("red","blue"))
I have tried using ggplot2 (I am starting with this package yet) but it shows up errors everytime. I sense that there is something that I am missing or not completely understanding about melting data frames or using ggplot2.