Displaying 1 result from an estimated 1 matches for "estcontplot".
2006 May 11
1
Conditional contour plots for estimated density functions using Lattice
...he contourplot function in the 'lattice' package only accepts data that
are on the form 'z ~ x * y', not on the form 'x,y' or 'y~x'; otherwise I
could probably have used the panel function to do the needed conversion.
Here is my current, not very elegant, solution:
estcontplot=function(x, y, grp, ...)
{
cest=matrix( nrow=0, ncol=4 )
for( i in levels(grp) )
{
cest.gr=kde2d( x[grp==i], y[grp==i] )
cest.gr.lat=con2tr(cest.gr)
cest.gr.lat=cbind(cest.gr.lat, i)
cest=rbind(cest, cest.gr.lat)
}
contourplot( z ~ x * y | i, data=cest,...