Hello, I am new to R and was wondering if anybody would be able to advice me on the following query. Is there any package available to generate a mixed Poisson process, temporal data, using R? If anybody has accomplished this before or has any advice I would appreciate it. Regards, Elaine Hand -- Elaine Hand Department of Community Health & General Practice Trinity College Dublin Trinity Centre for Health Sciences AMNCH Dublin 24 Ireland email: hande at tcd.ie telephone: +353 1 608 3460 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Harry Mangalam
2002-Oct-08 22:56 UTC
[R] Removal of temp files in R 1.60 with xgobi - reversable?
From the NEWS file for R 1.60: Each R session uses a per-session temporary directory which is removed at normal termination. The directory name is given by the tempdir() function, and filenames returned by tempfile() will be within that directory. Is there any way to maintain these temporary files? I use R to generate output files that are viewable with the xgobi package which has a 'keep' option to maintain temporary files, but this seems to be overridden in R itself. It worked OK with R up to 1.51, I think. I'd actually like to be able to specify the entire temp directory as well since I have to generate this directory anyway. -- Cheers, Harry Harry J Mangalam - 949 856 2847 (v&f) - hjm at tacgi.com (primary) <<plain text much appreciated>> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
One way to do this (for the interval [0,T]) is to first generate the total count n (from a mixture of Poissons), then generate an iid sample of n draws from the normalized intensity (representing the event times). (Then you probably want to sort them.) How to do these steps depends on the mixing distribution and normalized intensity. If the mixing distribution is discrete, say contained in vectors "intensity" (intensity value) and "p" (probability), you could generate a vector of N counts from the mixture as follows: lambda <- sample(x=intensity, size=N, replace=TRUE, prob=p) n <- rpois(n=N,lambda=lambda) In general you need a way like "sample" to draw a sample from your mixing distribution (and your normalized intensity). The "r" functions (rgamma, etc) might help if you are using common distributions. For example if you wanted a constant intensity, you could use runif as follows to get a list of N draws from the process: draws <- runif(sum(n),min=0,max=T) # all strung together f <- rep(1:N,n) # vector indicates group # membership (simulation trial #) of event sim <- split(draws,f) # chop draws up into trial i with n[i] events Reid Huntsinger -----Original Message----- From: Elaine Hand [mailto:hande at tcd.ie] Sent: Tuesday, October 08, 2002 7:04 AM To: r-help at stat.math.ethz.ch Subject: [R] temporal simulation Hello, I am new to R and was wondering if anybody would be able to advice me on the following query. Is there any package available to generate a mixed Poisson process, temporal data, using R? If anybody has accomplished this before or has any advice I would appreciate it. Regards, Elaine Hand -- Elaine Hand Department of Community Health & General Practice Trinity College Dublin Trinity Centre for Health Sciences AMNCH Dublin 24 Ireland email: hande at tcd.ie telephone: +353 1 608 3460 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._ ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ============================================================================= -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._