[S] generate graphs from simulated data

Chung-chi Chang (sph1606@utsph.sph.uth.tmc.edu)
Mon, 19 Oct 1998 11:44:20 -0500


Dear S-users:

I am the programming beginner.
I am using S-PLUS 4.5 to generate graphs from simulated data.
Below are my algorithm, I tried to save the results and generate
graphs out of these codes...but I didn't succeed....
I would appreciate it very much if any of you can help me here...:-)

function(t0, n0, i, cutoff)
{
repeat {
u1 <- - log(runif(1))
v1 <- ifelse(runif(1) >= 0.5, 1, 0)
t0 <- t0 + u1/n0
n0 <- n0 + 2 * v1 - 1
if(n0 == 0)
break
if(t0 > cutoff)
break
i <- i + 1
cat(t0, n0, "\n")
}
}

(Part of the results)
>birth.death(0,5,0,10)
0.079939867073538 6
0.158906939748543 5
0.345265117360861 4
0.474573701107174 5
0.551331853964223 6
0.569591981810852 7
0.6682170429582 8
1.05321973827359 9
1.1370603452131 10
1.19092369719137 9
1.29388628324322 8
1.42980981662195 9
1.65408159621749 8
1.73879239919602 7

--------------------------------------------------------------------
Chung-chi Chang, Doctoral Candidate in Biometry
University of Texas - Houston School of Public Health
1200 Herman Pressler Drive
RAS W-610
Houston, Texas 77030
Phone: (713)500-9246
E-mail: sph1606@utsph.sph.uth.tmc.edu
---------------------------------------------------------------------

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news