CDF - GoogleVis command for Cumulative Distribution plot

119 views Asked by At

Does anybody know what command/function from the GoogleVis package I can use to plot cumulative distribution functions (CDFs)?

1

There are 1 answers

0
DrPositron On

From the journal article here,

The googleVis package provides an interface between R and the Google Visualisation API. The functions of the package allow the user to visualise data stored in R data frames with the Google Visualisation API.

You need to generate a data frame of the CDF for your PDF such as this example for dnorm:

xlist<-seq(-5,5,0.01)
ylist<-numeric()
for (x in xlist) {
  ylist<-append(ylist,integrate(dnorm,-Inf,x)$value)
}
df<-data.frame(xlist,ylist)

I'm not sure what googleVis buys you for visualization of this function beyond a simple plot:

plot(df)

or in one line:

plot(Vectorize(function(X)integrate(dnorm,-5,X)$value),-5,5,add=TRUE)