I am trying to learn R right now. I came from minitab and wanted to learn something a bit more robust. I am trying to figure out some simple probability to measures but I do not know the commands. I am using OSX. Are there resources for figuring out simple events? If I have data distributed as Normal(5,4) and I wanted to know what the probability of P(<6) would be this, I cannot quite figute out how to work this out. -- View this message in context: http://www.nabble.com/Brand-new-To-R-tp25424799p25424799.html Sent from the R help mailing list archive at Nabble.com.
On Sep 13, 2009, at 12:47 PM, czarjosh wrote:> > I am trying to learn R right now. I came from minitab and wanted > to learn > something a bit more robust. I am trying to figure out some simple > probability to measures but I do not know the commands. I am using > OSX. > Are there resources for figuring out simple events? > > If I have data distributed as Normal(5,4) and I wanted to know what > the > probability of P(<6) would be this, I cannot quite figute out how to > work > this out. > --The R-help mailing list is not set up to solve homework or do basic tutorials on R, You are expected to do some (actually quite a bit) self-study. In R the functions to compute density and cumulative probability are generally grouped with the functions to generate random numbers. In the case of the Normal distribution, the three functions are all going to be described on the same help page. Any one of the following commands should give you that same help page: ?pnorm ?dnorm ?rnorm This should have been available to you by reading the "Introduction to R" on ... <dropping out of my mail client to access the pdf> ... page 35 Search for: " An Introduction to R" Notes on R: A Programming Environment for Data Analysis and Graphics Version 2.9.2 (2009-08-24) (by) W. N. Venables, D. M. Smith and the R Development Core Team The is also quite a bit of other documentation at the r-project website, some of which will be specific for MacOSX. There is also a specific MacOSX help mailing list that would be better for problems with graphics devices or concerns relative to the use of the GUI. Seek out further info at the Mailing lists information page which you have already probably encounters -- David Winsemius, MD Heritage Laboratories West Hartford, CT
czarjosh wrote:> > I am trying to learn R right now. I came from minitab and wanted to > learn something a bit more robust. I am trying to figure out some simple > probability to measures but I do not know the commands. I am using OSX. > Are there resources for figuring out simple events? >As David mentioned, the "Introduction to R" is a great place to start if you have never used the language before. With OS X, you can find it under the Help -> R Help menu. Then click on the link for "An Introduction to R". czarjosh wrote:> > If I have data distributed as Normal(5,4) and I wanted to know what the > probability of P(<6) would be this, I cannot quite figute out how to work > this out. >Functions for calculating probabilities and quantiles using distributions are covered in Section 8 of the introduction document. Hope this helps! -Charlie ----- Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://www.nabble.com/Brand-new-To-R-tp25424799p25425997.html Sent from the R help mailing list archive at Nabble.com.
On 13-Sep-09 16:47:07, czarjosh wrote:> > I am trying to learn R right now. I came from minitab and wanted > to learn something a bit more robust. I am trying to figure out > some simple probability to measures but I do not know the commands. > I am using > OSX. Are there resources for figuring out simple events? > > If I have data distributed as Normal(5,4) and I wanted to know what > the probability of P(<6) would be this, I cannot quite figute out how > to work this out.For each of the common distributions, there is a group of R functions giving the density/point probability, the cumulative probability, the inverse of this (i.e. whiat x corresponds to a given probability), and also a function for sampling randomly from it. In the 'help' files, these four are groups togther in a single file. For the Normal distribution, these functions are dnorm pnorm qnorm rnorm So, if you enter ther command ?pnorm you will get a summary for all of them. Similarly if you enter ?pnorm or ?qnorm or ?rnorm. For your query, the probability that X < 6 is simply pnorm(q=6,mean=5,sd=4), which you can abbreviate to pnorm(6,5,4): pnorm(q=6,mean=5,sd=4) # [1] 0.5987063 pnorm(6,5,4) # [1] 0.5987063 the reason they are equaivlent as given is that when the arguments are not named, R identifies them by position, so that in "pnorm(6,5,4)" it is assumed that q=6, mean=5, sd=4. If you prefer to give them in a different order, then you will have to name them: pnorm(4,5,6) # [1] 0.4338162 pnorm(sd=4,mean=5,q=6) # [1] 0.5987063 Similarly you will find dchisq, pchisq, qchisq, rchisq for the chi-squared distribution, dt, pt, qt, rt for the Student t distribution, df, pf, qf, rf for the F distribution, dbinom etc. for the Binomial, dpois etc. for the Poisson, and many others! Hoping this helps. Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 13-Sep-09 Time: 19:59:58 ------------------------------ XFMail ------------------------------