[R] Identifying matched groups based on a rule
Hello, I'm trying to create a table like below for a data set representing one test and indexed by five categories. Categories are grouped into a number of buckets (three in this case: A, B, C) based on the level at which the difference between groups is significant (0.05). Category, Group, Mean 1, A, 94.9 2, A, 94.8 3, A+B, 93.4 4, B+C, 91.4 5, C, 91.1 Is there a way to do this in R? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Stop on fail using data manipulation
Hello, I have a data set with test results for multiple devices (rows). I also have an index (column) that stores the first failing test for each device. I need to remove the results for all the tests that come after the first failing test. Example of a data table: Device,first_failing_test,test1,test2,test3,test4,test5 1,test2,1,2,3,4,5 2,test4,2,3,4,5,6 3,test1,3,4,5,6,7 New table: Device,first_failing_test,test1,test2,test3,test4,test5 1,test2,1,2,na,na,na 2,test4,2,3,4,5,na 3,test1,3,4,5,na,na Ideally I need to pass the first table as an argument to a function and get back the second table. Any idea how this can be done in R? Thanks [[alternative HTML version deleted]] __ 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] generate random numbers subject to constraints
I am trying to generate a set of random numbers that fulfill the following constraints: X1 + X2 + X3 + X4 = 1 aX1 + bX2 + cX3 + dX4 = n where a, b, c, d, and n are known. Any function to do this? Thanks, -Ala' __ 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] generate random numbers subject to constraints
X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks On Wed, Mar 26, 2008 at 12:52 PM, Ted Harding [EMAIL PROTECTED] wrote: On 26-Mar-08 20:13:50, Robert A LaBudde wrote: At 01:13 PM 3/26/2008, Ala' Jaouni wrote: I am trying to generate a set of random numbers that fulfill the following constraints: X1 + X2 + X3 + X4 = 1 aX1 + bX2 + cX3 + dX4 = n where a, b, c, d, and n are known. Any function to do this? 1. Generate random variates for X1, X2, based upon whatever unspecified distribution you wish. 2. Solve the two equations for X3 and X4. The trouble is that the original problem is not well specified. Your suggestion, Robert, gives a solution to one version of the problem -- enabling Ala' Jaouni to say I have generated 4 random numbers X1,X2,X3,X4 such that X1 and X2 have specified distributions, and X1,X2,X3,X4 satisfy the two equations ... . However, suppose the real problem was: let X2,X2,X3,X4 have independent distributions F1,F2,F3,F4. Now sample X1,X2,X3,X4 conditional on the two equations (i.e. from the coditional density). That is a different problem. As a slightly simpler example, suppose we have just X1,X2,X3 and they are independently uniform on (0,1). Now sample from the conditional distribution, conditional on X1 + X2 + X3 = 1. The result is a random point uniformly distributed on the planar triangle whose vertices are at (1,0,0),(0,1,0),(0,0,1). Then none of X1,X2,X3 is uniformly distributed (in fact the marginal density of each is 2*(1-x)). However, your solution would work from either point of view if the distributions were Normal. If X1,X2,X3,X4 were neither Normally nor uniformly distributed, then finding or simulating the conditional distribution would in general be difficult. Ala' Jaouni needs to tell us whether what he precisely wants is as you stated the problem, Robert, or whether he wants a conditional distribution for given distributions if X1,X2,X3,X4, or whether he wants something else. Best wishes to all, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 26-Mar-08 Time: 19:52:16 -- XFMail -- __ 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] generate random numbers subject to constraints
X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks __ 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.