Re: [R] Generic distributions

2007-03-07 Thread Alberto Monteiro
Matthias Kohl wrote:
 
 in distr you can do:
 
 library(distr)
 N - Norm(mean = 1, sd = 2)
 p(N)(0.5)
 r(N)(100)
 
 !!! not: p(N, 0.5) or r(N, 100) !!!
 A detailed description of package distr is given in package distrDoc.
 
 library(distrDoc)
 vignette(distr)
 
Thanks!!! This is almost perfect. It even has (some) arithmetics!!!

z1 - Norm(mean = 1, sd= 0.6)
z2 - Norm(mean = 2, sd= 0.8)
z1+z2

Distribution Object of Class: Norm
mean :  3 
sd :  1 
Warning message:
arithmetics on distributions are understood as operations on r.v.'s
see 'distrARITH()'; for switching off this warning see '?distroptions' in: 
print(object) 
 
Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Generic distributions

2007-03-06 Thread Alberto Monteiro
Is there any class that generalizes distributions?

For example, I could say 
x - generic_distribution(normal, list(mean=1, sigma=0.5))
and then use it like 
rgeneric_distribution(100, x) to get a sample of 100, or
pgeneric_distribution(0.5, x) to get the pdf at (x = 0.5).

In the openbugs/winbugs package, that uses a language that
looks like R/S, we can do things like x ~ dnorm(mu, tau),
forget that x is a normal with mean mu and variance 1/tau,
and then treat it generically.

Alberto Monteiro

PS: this is noise... but due to spam invasion, anything that
increases the nonspam/spam ratio should be welcome :-)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generic distributions

2007-03-06 Thread Greg Snow
I think the distr package does this.  There are also packages that link
to winbugs if that is what you really want to do.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Alberto Monteiro
 Sent: Tuesday, March 06, 2007 1:38 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Generic distributions
 
 Is there any class that generalizes distributions?
 
 For example, I could say
 x - generic_distribution(normal, list(mean=1, sigma=0.5)) 
 and then use it like rgeneric_distribution(100, x) to get a 
 sample of 100, or pgeneric_distribution(0.5, x) to get the 
 pdf at (x = 0.5).
 
 In the openbugs/winbugs package, that uses a language that 
 looks like R/S, we can do things like x ~ dnorm(mu, tau), 
 forget that x is a normal with mean mu and variance 1/tau, 
 and then treat it generically.
 
 Alberto Monteiro
 
 PS: this is noise... but due to spam invasion, anything that 
 increases the nonspam/spam ratio should be welcome :-)
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generic distributions

2007-03-06 Thread Matthias Kohl
Hello Alberto, hello Greg,

in distr you can do:

library(distr)
N - Norm(mean = 1, sd = 2)
p(N)(0.5)
r(N)(100)

!!! not: p(N, 0.5) or r(N, 100) !!!
A detailed description of package distr is given in package distrDoc.

library(distrDoc)
vignette(distr)

hth
Matthias



- original message 

Subject: Re: [R] Generic distributions
Sent: Tue, 06 Mar 2007
From: Greg Snow[EMAIL PROTECTED]

 I think the distr package does this.  There are also packages that link
 to winbugs if that is what you really want to do.
 
 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111
  
  
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Alberto Monteiro
  Sent: Tuesday, March 06, 2007 1:38 PM
  To: r-help@stat.math.ethz.ch
  Subject: [R] Generic distributions
  
  Is there any class that generalizes distributions?
  
  For example, I could say
  x - generic_distribution(normal, list(mean=1, sigma=0.5)) 
  and then use it like rgeneric_distribution(100, x) to get a 
  sample of 100, or pgeneric_distribution(0.5, x) to get the 
  pdf at (x = 0.5).
  
  In the openbugs/winbugs package, that uses a language that 
  looks like R/S, we can do things like x ~ dnorm(mu, tau), 
  forget that x is a normal with mean mu and variance 1/tau, 
  and then treat it generically.
  
  Alberto Monteiro
  
  PS: this is noise... but due to spam invasion, anything that 
  increases the nonspam/spam ratio should be welcome :-)
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

--- original message end 

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.