1 package ubic.basecode.util.r.type;
2
3 import java.util.List;
4
5 import org.rosuda.REngine.REXP;
6 import org.rosuda.REngine.REXPMismatchException;
7 import org.rosuda.REngine.RList;
8
9
10
11
12
13
14
15 public class HTest {
16
17 private String alternative = "";
18
19 private String dataname = "";
20
21 private Double estimate = Double.NaN;
22
23 private String method = "";
24
25 private Double nullvalue = Double.NaN;
26
27 private Double parameter = Double.NaN;
28
29 private Double pvalue = Double.NaN;
30
31 private Double statistic = Double.NaN;
32
33 public HTest() {
34 }
35
36 @SuppressWarnings("unchecked")
37 public HTest( RList rexp ) {
38
39 if ( rexp == null || rexp.size() == 0 ) {
40 return;
41 }
42
43 List<String> names = rexp.names;
44
45 try {
46 for ( String n : names ) {
47 REXP o = ( REXP ) rexp.get( n );
48
49 if ( n.equals( "method" ) ) {
50 this.method = o.asString();
51 } else if ( n.equals( "statistic" ) ) {
52 this.statistic = o.asDouble();
53 } else if ( n.equals( "parameter" ) ) {
54 this.parameter = o.asDouble();
55 } else if ( n.equals( "p.value" ) ) {
56 this.pvalue = o.asDouble();
57 } else if ( n.equals( "conf.inf" ) ) {
58
59 } else if ( n.equals( "data.name" ) ) {
60 this.dataname = o.asString();
61 }
62
63 }
64 } catch ( REXPMismatchException e ) {
65 throw new RuntimeException( e );
66 }
67
68 }
69
70 public String getAlternative() {
71 return alternative;
72 }
73
74 public String getDataname() {
75 return dataname;
76 }
77
78 public Double getEstimate() {
79 return estimate;
80 }
81
82 public String getMethod() {
83 return method;
84 }
85
86 public Double getNullvalue() {
87 return nullvalue;
88 }
89
90 public Double getParameter() {
91 return parameter;
92 }
93
94 public Double getPvalue() {
95 return pvalue;
96 }
97
98 public Double getStatistic() {
99 return statistic;
100 }
101
102 }