Re: [R] noisy quantisation; Bernoulli scheme

2009-05-05 Thread William Simpson
If I am right, the original version was a sinusoidally-modulated
(nonstationary) Bernoulli process. I want 3 possible values, not 2,
which makes it a "Bernoulli scheme"
http://en.wikipedia.org/wiki/Bernoulli_scheme

Not sure how to the create a sinusoidally modulated Bernoulli scheme
with values 0, 0.5, 1.

Bill

__
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.


Re: [R] noisy quantisation

2009-05-05 Thread William Simpson
If this helps, here is what I have currently

mean.p<- .5
contrast<-1
amp<- contrast*mean.p
freq<- 3
n<- 100
p<-amp*cos(2*pi*freq*(1:n)/n ) + mean.p
plot(p)
dens<-as.numeric(runif(1:n)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.


Re: [R] noisy quantisation

2009-05-05 Thread Dieter Menne
William Simpson  gmail.com> writes:

> 
> p<-amp*cos(2*pi*freq*(1:n)/n ) + 0.5
> 
> I was wondering if anyone can suggest a way to create a version where
> I get 0s, 1s, and 2s something like a noisy version of this:
> 
> 2  oo
> 
> 1o  o o
> 
> 0  ooo
> 

# It's always polite to add the trivial parts that
# make the example run out of the box
amp = 1
freq = 5
n = 100
p = 0.1

# Well, this is not a noisy version, but one with added spikes
# If that's ok for you, take it
p = amp*cos(2*pi*freq*(1:n)/n ) + 0.5* as.numeric(runif(1:n)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] noisy quantisation

2009-05-05 Thread William Simpson
The following creates a point process version of a sinewave (maybe
there's a better way):

p<-amp*cos(2*pi*freq*(1:n)/n ) + 0.5
as.numeric(runif(1:n)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.