Hello,

You can see the code for jitter by typing its name at the prompt.
Inline.

Em 09-10-2014 18:19, Ingrid Charvet escreveu:
Hello,

A quick question relating to the documentation of the jitter function:
http://127.0.0.1:15714/library/base/html/jitter.html

jitter(x, factor = 1, amount = NULL)

"If amount is NULL (default), we set a <- factor * d/5 where d is the smallest 
difference between adjacent unique (apart from fuzz) x values."

Therefore if length(x) = 1, then d = 0, which means jitter(x) should be equal 
to x?
Which is not the case, i.e.

x <- 1
jitter(x)
[1] 0.9842914

So how does jitter deals with this situation? Does it assume d = x?

It doesn't assume, it computes range(x) and acts accordingly. The code lines are

    z <- diff(r <- range(x[is.finite(x)]))
    if (z == 0)
        z <- abs(r[1L])

It has the effect of setting z to x. Try running them. (And with x <- 2 to see the difference.)

Hope this helps,

Rui Barradas

Thanks
IC

________________________________
This message and any attachments contain information that may be RMS Inc. 
confidential and/or privileged. If you are not the intended recipient (or 
authorized to receive for the intended recipient), and have received this 
message in error, any use, disclosure or distribution is strictly prohibited. 
If you have received this message in error, please notify the sender 
immediately by replying to the e-mail and permanently deleting the message from 
your computer and/or storage system.



        [[alternative HTML version deleted]]

______________________________________________
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