An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20071017/f97ce938/attachment.pl>
add random fluctuation x and y coordinates
3 messages · Eva Kaiserseder, ONKELINX, Thierry, Agustin Lobo
You need to do jitter(test$x, amount = 0.01) instead of jitter(test$x, amount = test$x + 0.01) HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney
-----Oorspronkelijk bericht-----
Van: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] Namens Eva Kaiserseder
Verzonden: woensdag 17 oktober 2007 8:32
Aan: r-sig-geo at stat.math.ethz.ch
Onderwerp: [R-sig-Geo] add random fluctuation x and y coordinates
Dear List,Sorry for posting again the same question but up to
now not all things are clear.
I've got a point pattern and a few events have duplicated
coordinates. In this way I want to add a minimal random
fluctuation in the x and y direction/coordinates. If I use
the jitter-function my fluctuations are too large. So I tried
to control it with the amount argument, but I can't find a
solution. How can I restrict them to the decimal
places?Thanks a lot for your help!Best regards, Eva I tried
something like this, to add fluctuation after the second
decimal place:
v1 <- c(428381.6, 428871.6, 408027.2, 406870.4)
v2 <- c(293884.6, 292929.8, 292621.0, 292014.1) test <-
as.data.frame(cbind(v1, v2))
colnames(test) <- c("x", "y")
coordinates(test) <- c("x","y")
# ? ? ? ? ?
r <- runif(length(v1), -0.01, 0.01)
jitter(test$x, amount = test$x + r)
jcoord <- cbind(jitter(test[,1], amount = test[,1] + r),
jitter(test[,2], amount = test[,2] + r))
_________________________________________________________________ [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
I've you use runif: > options(digits=11) > v1 <- c(428381.60000, 428871.60000, 408027.20000, 406870.40000) > v1 [1] 428381.6 428871.6 408027.2 406870.4 > v1+r [1] 428381.59167 428871.60388 408027.19276 406870.39058 I've you use jitter: > jitter(v1,0.01) [1] 428382.48671 428872.43348 408026.50774 406869.64816 Agus Eva Kaiserseder escribi?:
Dear List,Sorry for posting again the same question but up to now not all things are clear.
I've got a point pattern and a few events have duplicated coordinates. In this way I want to add a minimal random fluctuation in the x and y direction/coordinates. If I use the jitter-function my fluctuations are too large. So I tried to control it with the amount argument, but I can't find a solution. How can I restrict them to the decimal places?Thanks a lot for your help!Best regards, Eva
I tried something like this, to add fluctuation after the second decimal place:
v1 <- c(428381.6, 428871.6, 408027.2, 406870.4)
v2 <- c(293884.6, 292929.8, 292621.0, 292014.1)
test <- as.data.frame(cbind(v1, v2))
colnames(test) <- c("x", "y")
coordinates(test) <- c("x","y")
# ? ? ? ? ?
r <- runif(length(v1), -0.01, 0.01)
jitter(test$x, amount = test$x + r)
jcoord <- cbind(jitter(test[,1], amount = test[,1] + r), jitter(test[,2], amount = test[,2] + r))
_________________________________________________________________ [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Dr. Agustin Lobo Institut de Ciencies de la Terra "Jaume Almera" (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: Agustin.Lobo at ija.csic.es http://www.ija.csic.es/gt/obster