Dear R User, say I have this sample of data ( attach with). What i'm going to do is to test whether this data is uniformly distributed or not by finding the p-value. I've tried using the punif command but it gave me the value of 1 of all the data. Any suggestion on R command to find the p-value??Thanks in advance!! Cheers, Anisah -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: midpoint.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080612/cc5dfe2c/attachment.txt>
Here's a sample:> unif_rand_1 <- runif(1000); > unif_rand_2 <- runif(1000); > ks.test(unif_rand_1,unif_rand_2);Two-sample Kolmogorov-Smirnov test data: unif_rand_1 and unif_rand_2 D = 0.021, p-value = 0.9802 alternative hypothesis: two-sided So in your case:> ks.test( runif( length( your_data ) ), your_data );- John On Thu, Jun 12, 2008 at 9:55 AM, mohamed nur anisah < nuranisah_mohamed@yahoo.com> wrote:> Dear R User, > > say I have this sample of data ( attach with). What i'm going to do is to > test whether this data is uniformly distributed or not by finding the > p-value. I've tried using the punif command but it gave me the value of 1 of > all the data. Any suggestion on R command to find the p-value??Thanks in > advance!! > > Cheers, > Anisah > > > > 132968364 > 135945080 > 156539568 > 157817896 > 162399496 > 168344072 > 173146584 > 176302744 > 182878168 > 183946152 > 185068720 > 190791232 > 84317660 > 93708872 > 106810172 > 126800004 > 148519056 > 150945112 > 155771432 > 181069984 > 87104384 > > > ______________________________________________ > 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. > >[[alternative HTML version deleted]]
Something like. . .> midpoint <- c(132968364, 135945080, 156539568, 157817896,+ 162399496, 168344072, 173146584, 176302744, + 182878168, 183946152, 185068720, 190791232, + 84317660, 93708872, 106810172, 126800004, + 148519056, 150945112, 155771432, 181069984, + 87104384 + )> shapiro.test(midpoint)HTH, Patrick -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of mohamed nur anisah Sent: Thursday, June 12, 2008 9:56 AM To: r-help at r-project.org Subject: [R] p-value Dear R User, say I have this sample of data ( attach with). What i'm going to do is to test whether this data is uniformly distributed or not by finding the p-value. I've tried using the punif command but it gave me the value of 1 of all the data. Any suggestion on R command to find the p-value??Thanks in advance!! Cheers, Anisah This email message, including any attachments, is for th...{{dropped:6}}
Not sure if this is what you are looking for but you can get the p-value with something like this: # Create a vector mydata<- c(132968364, 135945080, 156539568, 157817896, 162399496, 168344072, 173146584, 176302744, 182878168, 183946152, 185068720, 190791232, 84317660, 93708872, 106810172, 126800004, 148519056, 150945112, 155771432, 181069984, 87104384) plot(density(mydata)) shapiro.test(mydata) From: mohamed nur anisah> > say I have this sample of data ( attach with). What > > i'm going to do is to test whether this data is > > uniformly distributed or not by finding the p-value. > > I've tried using the punif command but it gave me > the > > value of 1 of all the data. Any suggestion on R > command to > > find the p-value??Thanks in advance!! > > > > Cheers, > > Anisah132968364 > > 135945080 > > 156539568 > > 157817896 > > 162399496 > > 168344072 > > 173146584 > > 176302744 > > 182878168 > > 183946152 > > 185068720 > > 190791232 > > 84317660 > > 93708872 > > 106810172 > > 126800004 > > 148519056 > > 150945112 > > 155771432 > > 181069984 > > 87104384______________________________________________