the reason is that is more natural to use pnorm(), which also should a more efficient approximation of the Normal integral than intgrate(), you may even use
diff(pnorm(0:1, mean = 0.5, sd = 1.2)) however, the point I meant to make was to use the '...' argument that can found in many R functions. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Nils Hoeller" <[EMAIL PROTECTED]> To: "Matthias Kohl" <[EMAIL PROTECTED]> Cc: "Dimitris Rizopoulos" <[EMAIL PROTECTED]>; <r-help@stat.math.ethz.ch> Sent: Monday, January 22, 2007 8:49 AM Subject: Re: [R] Integration + Normal Distribution + Directory Browsing Processing Questions > Thank you, > > both work fine. Why is pnorm to prefer? > > Nils > > > Matthias Kohl schrieb: >> Hi, >> >> why don't you use pnorm? >> E.g., >> >> pnorm(1, mean = 0.1, sd = 1.2) - pnorm(0, mean = 0.1, sd = 1.2) >> >> Matthias >> >> ----- original message -------- >> >> Subject: Re: [R] Integration + Normal Distribution + Directory >> Browsing Processing Questions >> Sent: Sun, 21 Jan 2007 >> From: Dimitris Rizopoulos<[EMAIL PROTECTED]> >> >> >>> you can use the `...' argument of integrate, e.g., >>> >>> integrate(dnorm, 0, 1) >>> integrate(dnorm, 0, 1, mean = 0.1) >>> integrate(dnorm, 0, 1, mean = 0.1, sd = 1.2) >>> >>> look at ?integrate for more info. >>> >>> I hope it helps. >>> >>> Best, >>> Dimitris >>> >>> ---- >>> Dimitris Rizopoulos >>> Ph.D. Student >>> Biostatistical Centre >>> School of Public Health >>> Catholic University of Leuven >>> >>> Address: Kapucijnenvoer 35, Leuven, Belgium >>> Tel: +32/(0)16/336899 >>> Fax: +32/(0)16/337015 >>> Web: http://med.kuleuven.be/biostat/ >>> http://www.student.kuleuven.be/~m0390867/dimitris.htm >>> >>> >>> Quoting Nils Hoeller <[EMAIL PROTECTED]>: >>> >>> >>>> Hi everyone, >>>> >>>> I am new to R, but it's really great and helped me a lot! >>>> >>>> But now I have 2 questions. It would be great, if someone can >>>> help me: >>>> >>>> 1. I want to integrate a normal distribution, given a median and >>>> sd. >>>> The integrate function works great BUT the first argument has to >>>> be a >>>> function >>>> >>>> so I do integrate(dnorm,0,1) and it works with standard m. and >>>> sd. >>>> >>>> But I have the m and sd given. >>>> >>>> So for fixed m and sd I work around with a new function mynorm >>>> >>>> mynorm <- function(n) { >>>> ret <- dnorm(n,0.6,0.15) >>>> ret >>>> } >>>> >>>> for example. >>>> >>>> BUT what can I do for dynamic m and sd? >>>> I want something like integrate(dnorm(,0.6,0.15),0,1), with the >>>> first >>>> dnorm parameter open for the >>>> integration but fixed m and sd. >>>> >>>> I hope you can help me. >>>> >>>> 2. I am working with textfiles with rows of measure data. >>>> read.table("file") works fine. >>>> >>>> Now I want R to read.table all files within a given directory and >>>> process them one by the other. >>>> >>>> for(all files in dir xy) { >>>> x <- read.table(nextfile) >>>> process x >>>> } >>>> >>>> Is that possible with R? I hope so. Can anyone give me a link to >>>> >>> examples. >>> >>>> Thanks for your help >>>> >>>> Nils >>>> >>>> ______________________________________________ >>>> 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. >>>> >>>> >>>> >>> >>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm >>> >>> ______________________________________________ >>> 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 ---- >> >> >> -- >> Dr. rer. nat. Matthias Kohl >> [EMAIL PROTECTED] >> www.stamats.de >> >> > > ______________________________________________ > 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. > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ______________________________________________ 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.