Re: [R] need help for t.test using by

2009-08-19 Thread 1Rnwb

any one

1Rnwb wrote:
 
 I am trying to do ttest for each plate which has equal number of disease
 and controls. by searching this forum I found one posting suggesting OP to
 use by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub)). when i
 modified this for my use I used to get the pvalues for each plate,
 recently upgraded to R2.9.x and now i am getting following error when i
 use this 
  by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub))
 Error in t.test.formula(IL1Ra ~ Group, data = .sub) : 
   grouping factor must have exactly 2 levels
 
 I checked my data file and the plate ID has P16-P47 and the disease
 column is Y/N. I have search all but could not locate the answer. Can
 anyone suggest me the direction where i am going wrong. 
 for more detail i amm posting a part of my data.
 
 SampleID  PlateID Sex Disease DurationAge prt1prt2
 prt3prt4
 1 P16 F   N   25.33282811 836.08979   
 20.04582692 295.74  11731.43
 2 P16 F   N   32.74912883 243.0652116 
 53.16487056 383.63  4451.36
 3 P16 M   N   3.49961999  181.5587298 
 23.24604762 522.52  325.52
 4 P16 M   N   5.249771666 261.0978097 
 19.69024684 833.61  2229.04
 5 P16 M   N   39.16612385 237.334794  
 83.97284692 694.03  1204.36
 6 P16 F   N   33.49929145 540.486536  
 29.69569346 895.36  72105.75
 7 P16 F   N   3.915997361 5215.378446 
 35.44324704 1023.63 101680.69
 8 P16 F   N   33.49929145 466.5188732 
 12.93422535 814.26  7169.61
 9 P16 F   N   38.1661348  706.5117791 
 19.69024684 331.62  7296.72
 10P16 M   N   0.916030215 242.3011559 
 36.40117263 90.135962.08
 11P16 F   Y   14975.2542.08281552 133.8052501 
 29.0570764  260.55  1280.29
 12P16 M   Y   1095.75 40.41593932 247.6495456 
 19.69024684 161.64  6685.6
 13P16 F   Y   292225.08300169 231.6043765 
 9.022844487 902.53  37571.39
 14P16 F   Y   12053.2537.49924765 158.6370595 
 24.90606549 1.63471.15
 15P16 F   Y   14610   76.58209602 278.3837309 
 41.51010914 152.13  16285.49
 16P16 F   Y   3287.25 49.58239171 128.4568603 
 17.91234645 274.99  41823.21
 17P17 M   N   2.333079994 397.4440508 
 55.20987654 366.37  90011.27
 18P17 F   N   4.749435461 222.0839813 
 73.62489675 271.65  903.89
 19P17 F   N   1.749468315 676.8904636 
 47.7037037  721.19  663.15
 20P17 M   N   33.24946503 413.712486  
 27.42386831 611.64  4195.86
 21P17 F   N   15.4162131  346.9913086 
 30.71604938 302.29  2151.47
 22P17 F   N   33.3327405  2598.071161 
 107.8088094 1800.44 102005.12
 23P17 M   N   9.832656179 3296.535581 
 54.1563786  2642.73 676.78
 24P17 F   N   3.749446413 488.2589867 
 15.29151952 562.88  11619.62
 25P17 M   N   9.749380705 159.1536586 
 23.41690259 132.64  931.14
 26P17 M   Y   12053.2550.91548265 173.7764722 
 18.90280088 52.25   15962.05
 27P17 M   Y   3652.5  25.83248096 264.8254141 
 35.32510288 497.33  15504.95
 28P17 F   Y   28.41607073 415.3599225 
 35.0617284  1600.67 14224.39
 29P17 F   Y   6209.25 60.74882219 213.7280879 
 44.41152263 111.36  9018.48
 30P17 M   Y   4748.25 47.33258719 264.0016959 
 31.24279835 366.81  3809.83
 31P17 M   Y   16071   54.49906148 112.4128794 
 34.40329218 114.56  1727.02
 32P17 M   Y   7670.25 52.33253243 145.5753317 
 32.2962963  44.92   15264.84
 33P17 M   Y   876631.74913978 220.2561296 
 34.40329218 130.31  2377.36
 34P17 F   Y   8400.75 40.83231669 194.6662059 
 48.09876543 407.83  19587.61
 35P17 M   Y   12053.2536.1661567  212.1613578 
 96.51775947 621.42  3269.9
 36P17 M   Y   8035.5  57.91540599 115.2852178 
 24.79012346 282.88  8960.27
 37P17 M   Y   5478.75 36.33270765 160.4592669 
 40.72427984 102.32  5006.77
 38P17 F   Y   9496.5  34.74910692 329.8991551 
 40.32921811 417.32  248857.58
 39P18 F   N   14.2496731 

Re: [R] need help for t.test using by

2009-08-19 Thread David Winsemius


On Aug 19, 2009, at 9:00 AM, 1Rnwb wrote:



any one


I looked at your posting yesterday and could not figure out what your  
statistical question was, nor could I figure out how the t.test  
formula related to the column names in the data.frame. I saw no Group  
or IL1Ra variables in your data. I also tried to import that data and  
found that you had more column headers than columns. I gave up.


--
DW



1Rnwb wrote:


I am trying to do ttest for each plate which has equal number of  
disease
and controls. by searching this forum I found one posting  
suggesting OP to
use by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub)).  
when i

modified this for my use I used to get the pvalues for each plate,
recently upgraded to R2.9.x and now i am getting following error  
when i

use this

by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub))

Error in t.test.formula(IL1Ra ~ Group, data = .sub) :
 grouping factor must have exactly 2 levels

I checked my data file and the plate ID has P16-P47 and the disease
column is Y/N. I have search all but could not locate the answer.  
Can

anyone suggest me the direction where i am going wrong.
for more detail i amm posting a part of my data.

SampleIDPlateID Sex Disease DurationAge prt1prt2
prt3prt4
1   P16 F   N   25.33282811 836.08979   
20.04582692 295.74  11731.43
2   P16 F   N   32.74912883 243.0652116 
53.16487056 383.63  4451.36
3   P16 M   N   3.49961999  181.5587298 
23.24604762 522.52  325.52
4   P16 M   N   5.249771666 261.0978097 
19.69024684 833.61  2229.04
5   P16 M   N   39.16612385 237.334794  
83.97284692 694.03  1204.36
6   P16 F   N   33.49929145 540.486536  
29.69569346 895.36  72105.75
7   P16 F   N   3.915997361 5215.378446 
35.44324704 1023.63 101680.69
8   P16 F   N   33.49929145 466.5188732 
12.93422535 814.26  7169.61
9   P16 F   N   38.1661348  706.5117791 
19.69024684 331.62  7296.72
10  P16 M   N   0.916030215 242.3011559 
36.40117263 90.135962.08
11  P16 F   Y   14975.2542.08281552 133.8052501 
29.0570764  260.55  1280.29
12  P16 M   Y   1095.75 40.41593932 247.6495456 
19.69024684 161.64  6685.6
13  P16 F   Y   292225.08300169 231.6043765 
9.022844487 902.53  37571.39
14  P16 F   Y   12053.2537.49924765 158.6370595 
24.90606549 1.63471.15
15  P16 F   Y   14610   76.58209602 278.3837309 
41.51010914 152.13  16285.49
16	P16	F	Y	3287.25	49.58239171	128.4568603	17.91234645	274.99	 
41823.21

17  P17 M   N   2.333079994 397.4440508 
55.20987654 366.37  90011.27
18  P17 F   N   4.749435461 222.0839813 
73.62489675 271.65  903.89
19  P17 F   N   1.749468315 676.8904636 
47.7037037  721.19  663.15
20  P17 M   N   33.24946503 413.712486  
27.42386831 611.64  4195.86
21  P17 F   N   15.4162131  346.9913086 
30.71604938 302.29  2151.47
22  P17 F   N   33.3327405  2598.071161 
107.8088094 1800.44 102005.12
23  P17 M   N   9.832656179 3296.535581 
54.1563786  2642.73 676.78
24  P17 F   N   3.749446413 488.2589867 
15.29151952 562.88  11619.62
25  P17 M   N   9.749380705 159.1536586 
23.41690259 132.64  931.14
26	P17	M	Y	12053.25	50.91548265	173.7764722	18.90280088	52.25	 
15962.05

27  P17 M   Y   3652.5  25.83248096 264.8254141 
35.32510288 497.33  15504.95
28  P17 F   Y   28.41607073 415.3599225 
35.0617284  1600.67 14224.39
29  P17 F   Y   6209.25 60.74882219 213.7280879 
44.41152263 111.36  9018.48
30  P17 M   Y   4748.25 47.33258719 264.0016959 
31.24279835 366.81  3809.83
31  P17 M   Y   16071   54.49906148 112.4128794 
34.40329218 114.56  1727.02
32  P17 M   Y   7670.25 52.33253243 145.5753317 
32.2962963  44.92   15264.84
33  P17 M   Y   876631.74913978 220.2561296 
34.40329218 130.31  2377.36
34	P17	F	Y	8400.75	40.83231669	194.6662059	48.09876543	407.83	 
19587.61

35  P17 M   Y   12053.2536.1661567  212.1613578 
96.51775947 621.42  3269.9
36  P17 M   Y   8035.5  57.91540599 115.2852178 

Re: [R] need help for t.test using by

2009-08-19 Thread 1Rnwb

Thanks for the reply, and sorry for not being clear, I have ELISA data for 50
plates, equal number of disease and control samples are located on each
plates. I need to do the ttest between each proteins listed as prt1, prt2...
prt50 on all the plates 1-50, however for some proteins i have data for 40
plates and that is creating the problem for me when I run  
by(eo,eo$PlateID, function(.sub) t.test(prt1~Disease,data=.sub)). If i
only take the data for 40 plates, this command works, unfortunately I do not
want to make multiple copies of the same data over to do things.
Similarlyby(eo,eo$sex,function(.sub) t.test(prt1~Disease,data=.sub)) is
also not working when I select the data for 40 plates. I used these two
formulas earlier sucessfully. I am uploading a part of data as a delim file
for sample http://www.nabble.com/file/p25051220/r..txt r..txt . Thanks

1Rnwb wrote:
 
 any one
 
 1Rnwb wrote:
 
 I am trying to do ttest for each plate which has equal number of disease
 and controls. by searching this forum I found one posting suggesting OP
 to use by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub)).
 when i modified this for my use I used to get the pvalues for each plate,
 recently upgraded to R2.9.x and now i am getting following error when i
 use this 
  by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub))
 Error in t.test.formula(IL1Ra ~ Group, data = .sub) : 
   grouping factor must have exactly 2 levels
 
 I checked my data file and the plate ID has P16-P47 and the disease
 column is Y/N. I have search all but could not locate the answer. Can
 anyone suggest me the direction where i am going wrong. 
 for more detail i amm posting a part of my data.
 
 SampleID PlateID Sex Disease DurationAge prt1prt2
 prt3prt4
 1P16 F   N   25.33282811 836.08979   
 20.04582692 295.74  11731.43
 2P16 F   N   32.74912883 243.0652116 
 53.16487056 383.63  4451.36
 3P16 M   N   3.49961999  181.5587298 
 23.24604762 522.52  325.52
 4P16 M   N   5.249771666 261.0978097 
 19.69024684 833.61  2229.04
 5P16 M   N   39.16612385 237.334794  
 83.97284692 694.03  1204.36
 6P16 F   N   33.49929145 540.486536  
 29.69569346 895.36  72105.75
 7P16 F   N   3.915997361 5215.378446 
 35.44324704 1023.63 101680.69
 8P16 F   N   33.49929145 466.5188732 
 12.93422535 814.26  7169.61
 9P16 F   N   38.1661348  706.5117791 
 19.69024684 331.62  7296.72
 10   P16 M   N   0.916030215 242.3011559 
 36.40117263 90.135962.08
 11   P16 F   Y   14975.2542.08281552 133.8052501 
 29.0570764  260.55  1280.29
 12   P16 M   Y   1095.75 40.41593932 247.6495456 
 19.69024684 161.64  6685.6
 13   P16 F   Y   292225.08300169 231.6043765 
 9.022844487 902.53  37571.39
 14   P16 F   Y   12053.2537.49924765 158.6370595 
 24.90606549 1.63471.15
 15   P16 F   Y   14610   76.58209602 278.3837309 
 41.51010914 152.13  16285.49
 16   P16 F   Y   3287.25 49.58239171 128.4568603 
 17.91234645 274.99  41823.21
 17   P17 M   N   2.333079994 397.4440508 
 55.20987654 366.37  90011.27
 18   P17 F   N   4.749435461 222.0839813 
 73.62489675 271.65  903.89
 19   P17 F   N   1.749468315 676.8904636 
 47.7037037  721.19  663.15
 20   P17 M   N   33.24946503 413.712486  
 27.42386831 611.64  4195.86
 21   P17 F   N   15.4162131  346.9913086 
 30.71604938 302.29  2151.47
 22   P17 F   N   33.3327405  2598.071161 
 107.8088094 1800.44 102005.12
 23   P17 M   N   9.832656179 3296.535581 
 54.1563786  2642.73 676.78
 24   P17 F   N   3.749446413 488.2589867 
 15.29151952 562.88  11619.62
 25   P17 M   N   9.749380705 159.1536586 
 23.41690259 132.64  931.14
 26   P17 M   Y   12053.2550.91548265 173.7764722 
 18.90280088 52.25   15962.05
 27   P17 M   Y   3652.5  25.83248096 264.8254141 
 35.32510288 497.33  15504.95
 28   P17 F   Y   28.41607073 415.3599225 
 35.0617284  1600.67 14224.39
 29   P17 F   Y   6209.25 60.74882219 213.7280879 
 44.41152263 111.36  9018.48
 30   P17 M   Y   4748.25 47.33258719 264.0016959 
 31.24279835 366.81  3809.83
 31   P17 M   Y   16071   54.49906148  

[R] need help for t.test using by

2009-08-18 Thread 1Rnwb

I am trying to do ttest for each plate which has equal number of disease and
controls. by searching this forum I found one posting suggesting OP to use
by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub)). when i
modified this for my use I used to get the pvalues for each plate, recently
upgraded to R2.9.x and now i am getting following error when i use this 
 by(eo,PlateID, function(.sub) t.test(IL1Ra~Group,data=.sub))
Error in t.test.formula(IL1Ra ~ Group, data = .sub) : 
  grouping factor must have exactly 2 levels

I checked my data file and the plate ID has P16-P47 and the disease column
is Y/N. I have search all but could not locate the answer. Can anyone
suggest me the direction where i am going wrong. 
for more detail i amm posting a part of my data.

SampleIDPlateID Sex Disease DurationAge prt1prt2
prt3prt4
1   P16 F   N   25.33282811 836.08979   
20.04582692 295.74  11731.43
2   P16 F   N   32.74912883 243.0652116 
53.16487056 383.63  4451.36
3   P16 M   N   3.49961999  181.5587298 
23.24604762 522.52  325.52
4   P16 M   N   5.249771666 261.0978097 
19.69024684 833.61  2229.04
5   P16 M   N   39.16612385 237.334794  
83.97284692 694.03  1204.36
6   P16 F   N   33.49929145 540.486536  
29.69569346 895.36  72105.75
7   P16 F   N   3.915997361 5215.378446 
35.44324704 1023.63 101680.69
8   P16 F   N   33.49929145 466.5188732 
12.93422535 814.26  7169.61
9   P16 F   N   38.1661348  706.5117791 
19.69024684 331.62  7296.72
10  P16 M   N   0.916030215 242.3011559 
36.40117263 90.135962.08
11  P16 F   Y   14975.2542.08281552 133.8052501 
29.0570764  260.55  1280.29
12  P16 M   Y   1095.75 40.41593932 247.6495456 
19.69024684 161.64  6685.6
13  P16 F   Y   292225.08300169 231.6043765 
9.022844487 902.53  37571.39
14  P16 F   Y   12053.2537.49924765 158.6370595 
24.90606549 1.63471.15
15  P16 F   Y   14610   76.58209602 278.3837309 
41.51010914 152.13  16285.49
16  P16 F   Y   3287.25 49.58239171 128.4568603 
17.91234645 274.99  41823.21
17  P17 M   N   2.333079994 397.4440508 
55.20987654 366.37  90011.27
18  P17 F   N   4.749435461 222.0839813 
73.62489675 271.65  903.89
19  P17 F   N   1.749468315 676.8904636 
47.7037037  721.19  663.15
20  P17 M   N   33.24946503 413.712486  
27.42386831 611.64  4195.86
21  P17 F   N   15.4162131  346.9913086 
30.71604938 302.29  2151.47
22  P17 F   N   33.3327405  2598.071161 
107.8088094 1800.44 102005.12
23  P17 M   N   9.832656179 3296.535581 
54.1563786  2642.73 676.78
24  P17 F   N   3.749446413 488.2589867 
15.29151952 562.88  11619.62
25  P17 M   N   9.749380705 159.1536586 
23.41690259 132.64  931.14
26  P17 M   Y   12053.2550.91548265 173.7764722 
18.90280088 52.25   15962.05
27  P17 M   Y   3652.5  25.83248096 264.8254141 
35.32510288 497.33  15504.95
28  P17 F   Y   28.41607073 415.3599225 
35.0617284  1600.67 14224.39
29  P17 F   Y   6209.25 60.74882219 213.7280879 
44.41152263 111.36  9018.48
30  P17 M   Y   4748.25 47.33258719 264.0016959 
31.24279835 366.81  3809.83
31  P17 M   Y   16071   54.49906148 112.4128794 
34.40329218 114.56  1727.02
32  P17 M   Y   7670.25 52.33253243 145.5753317 
32.2962963  44.92   15264.84
33  P17 M   Y   876631.74913978 220.2561296 
34.40329218 130.31  2377.36
34  P17 F   Y   8400.75 40.83231669 194.6662059 
48.09876543 407.83  19587.61
35  P17 M   Y   12053.2536.1661567  212.1613578 
96.51775947 621.42  3269.9
36  P17 M   Y   8035.5  57.91540599 115.2852178 
24.79012346 282.88  8960.27
37  P17 M   Y   5478.75 36.33270765 160.4592669 
40.72427984 102.32  5006.77
38  P17 F   Y   9496.5  34.74910692 329.8991551 
40.32921811 417.32  248857.58
39  P18 F   N   14.2496731  538.5430144 
54.34303351 396