SCM

Forum: developers

Monitor Forum | Start New Thread Start New Thread
RE: plotting likelihood [ Reply ]
By: Ott Toomet on 2016-02-20 03:36
[forum:42969]
fortify/modularity is a good idea. Just i see that fortify is on the way of being deprecated:
http://docs.ggplot2.org/current/fortify.html
The replacement as I understand will be 'tidy' in 'groom' package.

Anyway, the main engine is a function that creates a data frame of likelihood values, be it tidy or fortify or whatever. Have you, Randall, thought about how to invoke it? In particular, I think that the API should permit to specify more general lines/surfaces/hyperspaces than just running along a single variable value. I mean this is not the first priority to implement, but if needed, the API should let us do that.

RE: plotting likelihood [ Reply ]
By: Arne Henningsen on 2016-02-16 07:39
[forum:42957]
I agree to have the plotting tools in a separate package to avoid too many dependencies of the maxLik package, particularly on graphical packages. I suggest to call it "maxLikPlot", because this clearly indicates that it is related to the maxLik pakage.

I also agree to make the package modular, e.g. by having one function / method for preparing the plotting data and another function / method for actually plotting, where one can choose the type of plot / plotting system.

RE: plotting likelihood [ Reply ]
By: Randall Pruim on 2016-02-15 13:33
[forum:42954]
I suggest an approach that separates generating the plotting data from generating the plot. That will (a) make it easier to support multiple plotting platforms without redundant code, and (b) allow users to create different plots of their own choosing by grabbing just the data.

ggplot2 uses a function called fortify() for this. So we could create a fortify method for maxLik objects to conform to this way of doing things. Even if we don't follow that approach precisely, keeping these things separated is a good idea.

If we support multiple plotting packages (base, ggplot2, lattice), the plot function could have an argument to determine which is generated. (In the mosaic package we have some functions like this and use system = c("lattice", "ggplot2") as the default argument value and system = match.arg(system); switch(system, ...) to control which type of plot is generated.

plotting likelihood [ Reply ]
By: Ott Toomet on 2016-02-15 03:42
[forum:42949]
I have for some time entertained the idea to develop plotting routines for maxLik, and now, as I understand, Randall wants to do that as well. This is why we need the function to be returned and be callable from elsewhere.

1) Should it be in maxLik or in a separate package? My preference is in a separate, to avoid dependencies on graphical packages (in particular, rgl). maxLikPlot? maxPlot?

2) I can imagine different plotting engines: R standard graphics 1d & 2d, ggplot, rgl 2d & 3d, maybe more. Perhaps
m <- maxLik(...)
plot(m, par="alpha", xlim=(0,2)) # standard R 1d graph plotting loglik as a function of 'alpha' b/w 0,2
plot3d(m, par=c("alpha", "beta"), xlim=c(0,2), ylim=c(1,3)) # rgl 2d plot of loglik as function of alpha, beta
...


Thoughts?
Ott

Thanks to:
Vienna University of Economics and Business Powered By FusionForge