From: Sergey Goriatchev <sergeyg_at_gmail.com>

Date: Sat, 12 May 2007 16:15:21 +0200

f<-numeric()

for(j in seq(xvec)){

*}
*

f<-Re(f)

round(f,4)

*}
*

R-help_at_stat.math.ethz.ch 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. Received on Sat 12 May 2007 - 14:22:41 GMT

Date: Sat, 12 May 2007 16:15:21 +0200

#Computes the p.m.f. via (10.53) of the number of i.i.d. Ber(p) trials #required until m consecutive successes occur. #Requires MASS package #==========================================================#consecpmf <- function(xvec, m, p, eps=1e-05){ library(MASS)

f<-numeric()

for(j in seq(xvec)){

x <- xvec[j] f[j] <- area(fun, -pi, pi, limit=1000, eps=eps, x, m, p)

f<-Re(f)

round(f,4)

fun <- function(t,x,m,p){

I <- exp(-1i*t*x)*cf(t,m,p)/(2*pi)

I

*}
*

#===================TESTING================================#consecpmf(seq(0,200),3,0.5)

R-help_at_stat.math.ethz.ch 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. Received on Sat 12 May 2007 - 14:22:41 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Sat 12 May 2007 - 17:31:32 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*