Best Answer mdsumner , 13 October 2016 - 09:24 AM
Hi, it's been a while since I used SGAT directly so I need to refresh my memory a bit, but the output of Estelle is chains is samples from the posterior, and these are just arrays so it's not too hard to build up plots from them. I would try something like
## collapse out the parallel-structure
chain <- chainCollapse(fit$z)
xy <- apply(chain, 1:2, mean)
rn <- apply(chain, 1:2, sd) ## sd may not be sensible, but other functions can be used here
plot(xy[,1], main = "longitude")
lines(xy[,1] - rn)
lines(xy[,2] + rn)
You'd want to get the range from rn and add it to the ylim first, something like
plot(xy[,1], main = "longitude", ylim = range(c(xy[,1] - rn, xy[,1] + rn))
and then do the same for latitude, on the same plot, etc.
But, I tend to use Pimage to get more than than this rectangular "error box", and for that you can use any map projection (though this is all from memory).
z <- Pimage(fit, type = "intermediate", proj = "laea")
## laea Lambert Azimuthal Equal Area is a good starting guess, and by default this will build a local map projection
plot(z[1:20]) ## the time-weighted probability map for the first 20 time steps
z ## the map for just the 5th time step
If you use type = "primary" you get the discrete estimates at the twilights ("x") rather than the smeared interval between them ("z").
With this you can employ any of the raster package tools to get proper contours of confidence intervals and so on, though we've never taken this to its full implementation. I'm happy to help if you contact me directly, or if you can share a fit object I can flesh out this here in more detail.
Also I'd be happy to show how to get a plot like FlightR if you can show me one, it'd take a bit of work for me to do that myself.
Cheers, Mike. Go to the full post