[R] How to obtain parameters of a mixture model of two lognormal distributions

2007-09-07 Thread Jacques Wagnor
Dear List, I have read that a lognormal mixture model having a pdf of the form f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1 and f2 are lognormal distributions. Any pointers on how to create a function that would produce the 5 parameters of f(x) would be greatly

[R] Aggregate daily data into weekly sums

2007-07-23 Thread Jacques Wagnor
Dear Lest, I have a two-variable data frame as follows (the time peirod of the actual data set is 10 years): Date Amount 1 6/1/2007 1 2 6/1/2007 1 3 6/4/2007 2 4 6/5/2007 2 5 6/11/2007 3 6 6/12/2007 3 7 6/12/2007 3 8 6/13/2007 3 9

[R] A question about riskmeasures() vs. qgpd() in library(evir)

2007-06-06 Thread Jacques Wagnor
Dear List, This inquiry probably does not directly pertain to R. I am using library(evir) to learn EVT. Based on my reading of things, it is my understanding that if one wants to calculate quantiles of GPD, one could use either riskmeasures() or qgpd(). However, using data(danish) as an

[R] R keeps crashing when executing 'rlogspline'

2007-05-31 Thread Jacques Wagnor
Dear List, I have a simple model as follows: x - rnorm(500) library(logspline) fit - logspline(x) n - 100 y - replicate(n, sum(rlogspline(rpois(1,10), fit))) # last line The problem I keep getting is R crashes when doing the last line. It seems to be fine if n is small, but not if n is

[R] Alternatives to unlist()

2007-05-04 Thread Jacques Wagnor
Given the following, one of the things I am trying to see is what % of draws are below a certain number: lambda - 3 rate - 5 n - 5 set.seed(123) v - replicate(n, rexp(rpois(1,lambda), rate)) vv - unlist(v) cat(% of draws below 0.1:, round(length(subset(vv, vv 0.1))/length(vv)*100,0), %\n) In

Re: [R] A question about POSIXct

2007-05-03 Thread Jacques Wagnor
A follow-up question: The example in ?attr uses a character string of dim. Besides dim and times, what other character strings are available or can be used? On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote: Hello, It seems that danish is a numeric vector with attributes attached - the

Re: [R] A question about POSIXct

2007-05-03 Thread Jacques Wagnor
Thank you, Mike! On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote: Hello, It seems that danish is a numeric vector with attributes attached - the attribute vector is POSIXct and is the same length as danish. You can create this from a data frame like this: x - data.frame(Date =