On 07/10/2009 5:50 PM, gcheer3 wrote:
Thanks for your reply.

But I don't think it will really help. My problem is as follows:

I have 20 observations
y <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3])

I have a loglikelihood function for 3 variables mu<-(mu1,mu2) and sig
        loglike <- function(mu,sig){
        temp<-rep(0,length(y))
        for (i in 1:(length(y)))
        {
temp[i]<-log((1/2)*dnorm(y[i],mu[1],sig)+(1/2)*dnorm(y[i],mu[2],sig))}
        return(sum(temp))
         }

for example
mu<-c(1,1.5)
sig<-2
loglike(mu,sig)
[1] -34.1811

I am interested how mu[1], mu[2], and sig changes, will effect the
loglikelihood surface. At what values of mu and sig will make loglikelihood
the maximum and at what values of mu and sig will make loglikelihood has
local max (smaller hills) and at what values of mu and sig the loglikelihood
is flat , etc.
I tried contour3d also, seems doesn't work

I haven't seen any replies to this. One explanation would be that everyone was turned off (as I was) by the rude remark above.

On this list, before saying that something "doesn't work", it's polite to give a simple, nicely formatted, self-contained reproducible example of what went wrong, and to ask whether it is your error or an error in the package. Taking that approach will usually result in someone pointing out your error (and fixing your code); sometimes it will result in a package author agreeing it's a bug, and fixing it.

Duncan Murdoch


Thanks for any advice


Ryan-50 wrote:
Suppose there are 4 variables
d is a function of a , b and c
I want to know how a, b and c change will make d change
It will be straightforward to see it if we can graph the d surface

if d is only a function of a and b, I can use 'persp' to see the surface
of
d. I can easily see at what values of a and b, d will get the maxium or
minium or multiple modes, etc

But for 4 dimention graph, is there a way to show the surface of d
Will use color help

Thanks a lot
Not sure what your data looks like, but you might also consider looking at a 2 dimensional version. See ?coplot
for example:

coplot(lat ~ long | depth * mag, data = quakes)

Or you can make 2 or 3-dimensional plots using the lattice package conditioning on some of the variables - e.g. d ~ a | b * c, etc.
If a, b, and c are "continuous", you can use equal.count.  Here is
an uninteresting example, considering a, b, and c as points along
a grid:

a <- b <- c <- seq(1:10)
dat <- data.frame(expand.grid(a, b, c))
names(dat) <- letters[1:3]

dat$d <- with(dat, -(a-5)^2 - (b-5)^2 - (c-5)^2)

library(lattice)
# 2-d:
xyplot(d ~ a | equal.count(b)*equal.count(c), data=dat, type="l")
# etc.

# 3-d:
contourplot(d ~ a * b | equal.count(c), data=dat)
wireframe(d ~ a * b | equal.count(c), data=dat)

______________________________________________
R-help@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.




______________________________________________
R-help@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.

Reply via email to