[R] Two dimensional likelihood surface plot

David Winsemius dwinsemius at comcast.net
Tue Nov 11 21:53:44 CET 2014


On Nov 11, 2014, at 11:17 AM, Gyanendra Pokharel wrote:

> Hi R users,
> I am trying to plot two dimensional posterior likelihood surface. I have a
> data like
> 
> para1     para2     likehood
> .......      ........      ...........
> .......      ........      ...........
> 
> 
> 
> I looked at contour plot but it needs a shorted values of parameters and a
> matrix of likelihood values. Is there any way to get the plot? or how can I
> change my likelihood values to a matrix for the function "contour"?

If the data are organized in a regular manner, then this might succeed:

with( df, contour( x=unique(para1), y=unique(para2)
                   z= matrix( likehood, length(unique(para1), length(unique(para2) )
     )           )

> 
> Any suggestions are appreciated.
> 
> 
> GP
> University of Guelph
> Guelph, ON
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list