[R] Compare similarit of two vector of not same length

Greg Snow 538280 at gmail.com
Sun Mar 25 04:01:15 CEST 2012


If you are trying to see if both vectors could be random samples from
the same population then I would look at a qqplot (see ?qqplot) which
will compare them visually (and if they are not the same length then
the qqplot function will use interpolation to compare them.  For a
more formal test you can use the ks.test function (also can take
vectors of different length), just note that a non-significant result
does not mean that they are the same, and with big sample sizes this
can be significant even though the differences are not practically
meaningful.  Another option is to do the qqplot along with the
vis.test function in the TeachingDemos package, this lets you do a
test based on the qqplot, but also gives you a feel for the practical
difference.

On Sat, Mar 24, 2012 at 5:44 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> this is not strictly R question. I have two vectors of different length (this is in the order of 10%). I am trying to see if still one can compare these two for similarity.
>
> IF the vectors were of the same length I would just take the difference of the two and plot a pdf of it.
>
> One way I am thinking is prorbably to find the longer length and short it in some way to get to the length of the short.
>
>
> Which are the math formulations for this type of problems and which of those R supports?
>
> Regards
> Alex
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list