Re: [R] A coding question involving variable assignments in ifelse()

2007-04-27 Thread xpRt.wannabe
for your time and suggestion. On 4/26/07, Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/26/2007 5:21 PM, xpRt.wannabe wrote: I made a few slight modifications to the original model in an effort to see the inner workings of the code: deductible - 1 coverage.limit - 2 insurance.threshold

[R] A coding question involving variable assignments in ifelse()

2007-04-26 Thread xpRt.wannabe
Dear List, Below is a simple, standard loss model that takes into account the terms of an insurance policy: deductible - 15 coverage.limit - 75 insurance.threshold - deductible + coverage.limit tmpf - function() { loss - rlnorm(rpois(1, 3), 2, 5) sum(ifelse(loss insurance.threshold, loss -

Re: [R] A coding question involving variable assignments in ifelse()

2007-04-26 Thread xpRt.wannabe
(accept payout, ifelse(loss insurance.threshold, loss - coverage.limit, pmin(loss, deductible)), 0)) } net - replicate(100, tmpf()) On 4/26/07, Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/26/2007 12:48 PM, xpRt.wannabe wrote: Dear List, Below is a simple, standard loss model

Re: [R] A coding question involving variable assignments in ifelse()

2007-04-26 Thread xpRt.wannabe
. Any further suggestions would be greatly appreciated. On 4/26/07, Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/26/2007 2:31 PM, xpRt.wannabe wrote: Just to be sure, is what I have below the right intepretation of your suggestion: Yes, that's what I suggested. Duncan Murdoch deductible

Re: [R] How to iteratively extract elements out of a list

2006-08-26 Thread xpRt.wannabe
]) sub4.m[unlist(lapply(sub4.m, function(x) length(x) 0))] [[1]] [1] 5 Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) xpRt.wannabe wrote: Yet another question: Let's say I do the following

[R] How to iteratively extract elements out of a list

2006-08-25 Thread xpRt.wannabe
Dear List, The following code produces a list, which is what I what: set.seed(123) tmpf - function() { x - rpois(rpois(1,4),2) } n - 3 m - replicate(n,tmpf()) m [[1]] [1] 3 2 4 [[2]] [1] 0 2 4 2 2 5 2 [[3]] [1] 2 0 4 1 0 Now I need something that would to extract iteratively (or as many

Re: [R] How to iteratively extract elements out of a list

2006-08-25 Thread xpRt.wannabe
] 2 0 4 1 0 lapply(m, function(x)x[x2]) [[1]] [1] 3 4 [[2]] [1] 4 5 [[3]] [1] 4 On 8/25/06, xpRt.wannabe [EMAIL PROTECTED] wrote: Dear List, The following code produces a list, which is what I what: set.seed(123) tmpf - function() { x - rpois(rpois(1,4),2) } n - 3

Re: [R] How to iteratively extract elements out of a list

2006-08-25 Thread xpRt.wannabe
[[3]] [1] 2 0 4 1 0 lapply(m, function(x)x[x2]) [[1]] [1] 3 4 [[2]] [1] 4 5 [[3]] [1] 4 On 8/25/06, xpRt.wannabe [EMAIL PROTECTED] wrote: Dear List, The following code produces a list, which is what I what: set.seed(123) tmpf - function() { x

[R] Fitting Truncated Lognormal to a truncated data set (was: fitting truncated normal distribution)

2006-08-17 Thread xpRt.wannabe
Dear List, I am trying to fit Truncated Lognormal to a data set that is 'truncated' from above a certain value, say, 0.01. Below is what I was able to come up with. I would appreciate it if you could review and make any necessary changes. # This is modified off the code for 'dtnorm' of

Re: [R] A coding question

2006-06-02 Thread xpRt.wannabe
- rnorm(rpois(1,5)) sum(ifelse(x90,x-75,pmin(x,15))) } replicate(10,replicate(8,tmpf())) On 6/2/06, Uwe Ligges [EMAIL PROTECTED] wrote: xpRt.wannabe wrote: Dear List: I have the follow code: y - replicate(10,replicate(8,sum(rnorm(rpois(1,5) Now I need to apply the following

[R] A coding question

2006-06-01 Thread xpRt.wannabe
Dear List: I have the follow code: y - replicate(10,replicate(8,sum(rnorm(rpois(1,5) Now I need to apply the following condition to _every_ randomly generated Normal number in the code above: x - max(0,x-15) + max(0,x-90), where x represents the individual Normal numbers. In other words,

[R] Is there a way to view S-PLUS script files in R

2006-03-16 Thread xpRt.wannabe
Dear List, I have some S-PLUS script files (.ssc). Does there exist an R function/command that can read such files? I simply want to view the code and practice in R to help me learn the subject matter. Any help would be greatly appreciated. platform i386-pc-mingw32 arch i386 os

[R] How to show the intermediate tick marks without the values in a different color

2006-03-02 Thread xpRt.wannabe
Is there a way to show also the intermediate tick marks without the values? Example: plot(cars) What would one do to show the tick marks in, say, gray color at the increment of 1 without showing the actual values in-between the default x values: 5, 10, 15, 20, 25? platform i386-pc-mingw32 arch

[R] Another question related to box-percentile plot, bpplot(): How to color the box or middle half of the data

2005-10-18 Thread xpRt.wannabe
Dear List, A follow-up question related to bpplot() of the Hmisc package: How does one color the box , or the middle half of the data, of a box-percentile plot? bpplot(... , col=lightgray) apparently does not work, though boxplot(... , col=lightgray) works. With much appreciation, platform

[R] A two-part question about box-percentile plots, bpplot(): (1) yaxt=n doesn't seem to work (2) how to display mean values

2005-10-17 Thread xpRt.wannabe
Dear List, I have a two-part question related to bpplot(), a box-percentile plot function in the Hmisc package. Take the example given in the Help for bpplot(), for instance. (1) How does one set but not draw the y-axis? What I did was, bpplot(... , yaxt=n), but that apparently does not work

[R] Add lines to density plot

2005-09-16 Thread xpRt.wannabe
Dear List, I am using R to learn bootstrapping concepts. Not to be oblivious to the contributed packages of boot and bootstrap, I have opted to do the following as a way to hone my R skills. One example I am trying to work through is the following: x - 1:20 Observed - sample(x,20) Resamples -

[R] A coding question involving variable assignments

2005-08-11 Thread xpRt.wannabe
Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? __

Re: [R] A coding question involving variable assignments

2005-08-11 Thread xpRt.wannabe
,replicate(10 ... ) In the end, I expect to get 10 x 5 max values. In that context, how might the code be changed? On 8/11/05, jim holtman [EMAIL PROTECTED] wrote: temp - rnorm(rpois(1,10)) x - replicate(5,replicate(10,sum(temp))) temp - max(temp) On 8/11/05, xpRt.wannabe [EMAIL PROTECTED

Re: [R] A coding question involving variable assignments

2005-08-11 Thread xpRt.wannabe
Ted and List, In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 05:55, xpRt.wannabe wrote,: Dear List

Re: [R] A coding question involving variable assignments

2005-08-11 Thread xpRt.wannabe
/08/05 12:17, xpRt.wannabe wrote,: Ted and List, In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05

Re: [R] A coding question involving variable assignments

2005-08-11 Thread xpRt.wannabe
Thank you! That was helpful. Another thing I learned was that I would need to do set.seed(99) not once but twice in this context. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 13:27, xpRt.wannabe wrote,: Ted and List, What I need is I need to know what max of rnorm(rpois