Skip to content

Help: CDF plot

2 messages · Zia Ahmed, Edzer Pebesma

#
I want to write a R- function to make a CDF plot of all realizations 
(sim1, sim2, sim3........) with CDF of observed data (suppose zinc of 
muse data). Help will be appreciated
Thanks
Zia

library(gstat)

data(meuse)

data(meuse.grid)

coordinates(meuse) = ~x + y

coordinates(meuse.grid) = ~x + y

lzn.vgm <- variogram(log(zinc) ~ 1, meuse)

lzn.fit <- fit.variogram(lzn.vgm, model = vgm(1, "Sph", 900, 1))

lzn.sim <- krige(log(zinc) ~ 1, meuse, meuse.grid, v.fit, nsim = 6, nmax 
= 40)

/lzn.sim at data <- exp(lzn.sim at data)/

/ /


/ /



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101021/9857b9c7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zua3.vcf
Type: text/x-vcard
Size: 281 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101021/9857b9c7/attachment.vcf>
#
On 10/21/2010 08:42 PM, Zia Ahmed wrote:
It can be me, but after reading your wish several times, I still don't
understand what you want. Do you want to make a cdf plot of each
realization?

plot(ecdf(lzn.sim[[1]])) # etc

Or for each location over all realizations? For threshold z:

z = 5.0
nsim = 6
lzn.sim$z = apply(as.data.frame(lzn.sim)[-(1:2)] <= z, 1, sum)/nsim
spplot(lzn.sim["z"])

Or of the observed values?

plot(ecdf(meuse$zinc))