[R] Weighting data with normal distribution

Alice Lin alice.ly at gmail.com
Thu Mar 26 20:00:33 CET 2009


I have a vector of binary data – a string of 0’s and 1’s. 
I want to weight these inputs with a normal kernel centered around entry x
so it is transformed into a new vector of data that takes into account the
values of the entries around it (weighting them more heavily if they are
near).

Example:
      -
   -     -
-          -
0 1 0 0 1 0 0 1 1 1 1 
If x = 3, it’s current value is 0 but it’s new value with the Gaussian
weighting around would be something like .1*0+.5*1+1*0+0.5*0+.1*1= 0.6

I want to be able to play with adjusting the variance to different values as
well.
I’ve found wkde in the mixtools library and think it may be useful but I
have not figured out how to use it yet.

Any tips would be appreciated.

Thanks!

-- 
View this message in context: http://www.nabble.com/Weighting-data-with-normal-distribution-tp22728289p22728289.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list