[R] cdf

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Wed Oct 14 00:30:11 CEST 2009


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of maram salem
> Sent: Tuesday, October 13, 2009 2:13 PM
> To: r-help
> Subject: [R] cdf
> 
> Dear all,
> I have the cdf of the following power fuction distribution:
> F(y)=(y/350)^a               ,0<y<350,
> where " a " is some parameter with range a>0.
> I want to use it as the argument of the discretize function of the actuar package.
> 
> So I think I need to define this function to R so that if I entered a=1, I get the
> following
> F(y)=(y/350)
> and if I entered a=4.5, I get the following
> F(y) =(y/350)^4.5
> ........... and so on
> 
> I've tried
> a<-vector(mode="numeric",length=1)
> powercdf<-function(a,y)
> (y/350)^a
> 
> But when I typed: powercdf(10,y)
> instead of getting : (y/350)^10     (which is what I want)
> I got : object y not found ??
> 
> I want y to remain as it is, a continous variable, not for example seq(0,350).
> Thank you in advance.
> Maram
> 

You say "I want y to remain as it is, ...".  where is y defined outside of your function?

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204




More information about the R-help mailing list