[R] How to set up a function for "Central Limit Theorem"
Hello guys, I am stuck here: How do I make 1000 samples of n = 10 observations from an Exponential distribution and then compute the mean for all those 1000 samples? Basically I need to prove the Central Limit theorem, which states: http://www.nabble.com/file/p22664113/d175f06cbf200bd52a2c27a2e56dc594.png Where the Sn is sum of random variables, n we have from the question, mu is mean and (sigma)^2 is variance. I am having trouble setting up the function to do this. Any help apreciated! -- View this message in context: http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22664113.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to set up a function for "Central Limit Theorem"
I tried using the for (i..) to make 1000 differents sets of numbers, but then I dont know how to get the mean value of all of them... because I dont even think 1000 different sets of numbers were made, because when i print it it always shows me the same values, basically I dont know how to replicate the funcion many times. stephen sefick wrote: > > homework? > > On Mon, Mar 23, 2009 at 1:30 PM, pfc_ivan wrote: >> >> Hello guys, I am stuck here: >> >> How do I make 1000 samples of n = 10 observations from an Exponential >> distribution and then compute the mean for all those 1000 samples? >> >> Basically I need to prove the Central Limit theorem, which states: >> >> http://www.nabble.com/file/p22664113/d175f06cbf200bd52a2c27a2e56dc594.png >> >> Where the Sn is sum of random variables, n we have from the question, mu >> is >> mean and (sigma)^2 is variance. >> >> I am having trouble setting up the function to do this. >> >> Any help apreciated! >> >> -- >> View this message in context: >> http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22664113.html >> Sent from the R help mailing list archive at Nabble.com. >> >> __ >> R-help@r-project.org 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. >> > > > > -- > Stephen Sefick > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > __ > R-help@r-project.org 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. > > -- View this message in context: http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22666250.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Omitting a desired line from a table [Beginner Question]
I am a beginner using this R software and have a quick question. I added a file into the R called fish.txt using this line. fish<-read.table("fish.txt", head=T, fill=T) The .txt file looks like this. Since it contains like 30 lines of data I will copy/paste first 5 lines. Year GeoArea SmpNo Month 1970113 7 197111310 1972113 8 197321310 197411311 Now what I want to do is to omit all the lines in the file that arent happening in GeoArea 1, and that arent happening in Month 10. So basically The only lines that I want to keep are the lines that have GeoArea=1 and Month=10 at the same time. So if GeoArea=2 and Month=10 I dont need it. So i just need the lines that have both of those values correct. How do I delete the rest of the lines that I dont need? Thank you everyone. -- View this message in context: http://www.nabble.com/Omitting-a-desired-line-from-a-table--Beginner-Question--tp21657416p21657416.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Newbie Question About Histograms
Hello everyone. Just have a question , cant figure out how to make this histogram. I have this table, that i stored in a variable name new.data2. Table looks like this Year GeoArea SmpNo Month Gear Maturity Length Age YearC 1989 1 36210 221225 1 1988 1991 1 26710 101191 1 1990 1991 1 26710 101202 1 1990 1992 1 3051081162 1 1991 1992 1 3051081165 1 1991 1992 1 3051081166 1 1991 1992 1 3051081167 1 1991 1992 1 3051081167 1 1991 1992 1 3051081169 1 1991 1992 1 3051081170 1 1991 Now I need to make a histogram of Length vs YearC. I would guess that Length would be on the Y-axis and YearC variable would be on X-axis. I have tried many different combinations with command 'hist' but im always getting error " 'x' must be numeric " ... I think im getting that error because of the header which is not numeric. Any help would be appreciated. Thanks guys. Ivan. -- View this message in context: http://www.nabble.com/Newbie-Question-About-Histograms-tp21713626p21713626.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Newbie Question About Histograms
Also I forgot to say that The Y-axis values for each YearC would be the mean value of all the Lenghts that happen in that YearC. Basically I cant figure out how to put the mean values of Lengths for each YearC on Y axis. Thanks in advance! -- View this message in context: http://www.nabble.com/Newbie-Question-About-Histograms-tp21713626p21714995.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Using color and plotting characters in a scatterplot matrix [Newbie Help]
Hello guys, I have this data set that I imported into R using a line: This data set consists of 7 columns. The two important columns are the first one called 'thrust' and the last one called 'amtemp'. jet<-read.table("jetthrust.txt", fill=T, head=T) I am making a scatterplot matrix simply using the line "pairs(jet)" The problem is that in the last column of this file which has a header name 'amtemp' I want to sort out the values. I want values: Under 90: To be called low values In between 90 and 100: To be called medium values Larger than 100: To be called high values Then I want those groups of values to be in different colors and different characters on the scatterplot! I tried many ways, And I think I am stuck. I first tried it on a normal plot using the line. plot(thrust~amtemp,jet, subset=(jet$amtemp<90), col=1, pch=11) plot(thrust~amtemp,jet, subset=(jet$amtemp<100), col=2, pch=12) plot(thrust~amtemp,jet, subset=(jet$amtemp>100), col=3, pch=13) It didnt work because it just took the last plot and overwrite it over the last one :( Someone help please. Thanks in advance. -- View this message in context: http://www.nabble.com/Using-color-and-plotting-characters-in-a-scatterplot-matrix--Newbie-Help--tp21824880p21824880.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Using color and plotting characters in a scatterplot matrix [Newbie Help]
I figured out how to do the rest, the only thing I need to do now is to somehow change the numbers which are < 90 to a character string "low" . The values which are between 100 - 90 to convert to character string "medium". And the values larger than 100 to convert to character string "high". Then I would use this line. plot(thrust~amtemp, jet, col=as.numeric(jet$amtemp), pch=as.numeric(jet$amtemp)) The thing is that I dont know how to convert those numerical values into "low" "medium" and "high" Hmm, but then when I think about it better if its changed to the strings above, it wont remember the exact numerical value. Basically what I want to do is make a scatterplot and then just change the color and the symbol of those 3 groups so they can be distinguished on the graph. -- View this message in context: http://www.nabble.com/Using-color-and-plotting-characters-in-a-scatterplot-matrix--Newbie-Help--tp21824880p21825882.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.