Skip to content

Commit 0e39795

Browse files
committed
Merge branch 'hotfix-1.1.28'
2 parents 07281bd + 79fe479 commit 0e39795

27 files changed

Lines changed: 2244 additions & 1712 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>baseCode</name>
66
<groupId>baseCode</groupId>
77
<artifactId>baseCode</artifactId>
8-
<version>1.1.27</version>
8+
<version>1.1.28</version>
99
<inceptionYear>2003</inceptionYear>
1010
<description>
1111
<![CDATA[Data structures, math and statistics tools, and utilities that are often needed across projects.]]>
Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* The baseCode project
3-
*
3+
*
44
* Copyright (c) 2010 University of British Columbia
5-
*
5+
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
@@ -16,62 +16,50 @@
1616
* limitations under the License.
1717
*
1818
*/
19+
package ubic.basecode.math.linearmodels;
1920

20-
package ubic.basecode.util.r.type;
21+
import org.apache.commons.lang3.StringUtils;
2122

2223
import java.io.Serializable;
2324

24-
import org.apache.commons.lang3.StringUtils;
25-
2625
/**
2726
* Represents one row of an ANOVA table
28-
*
27+
*
2928
* @author paul
30-
*
29+
*
3130
*/
3231
public class AnovaEffect implements Serializable {
3332

3433
private static final long serialVersionUID = 1L;
3534

36-
private Double degreesOfFreedom = null;
37-
38-
private String effectName = null;
39-
40-
private Double fStatistic = Double.NaN;
41-
42-
private boolean isInteraction = false;
43-
44-
private Double meanSq = Double.NaN;
45-
46-
private Double pValue = Double.NaN;
47-
48-
private Double ssQ = Double.NaN;
49-
50-
/**
51-
* @param effectName
52-
* @param pValue
53-
* @param fStatistic
54-
* @param degreesOfFreedom
55-
* @param ssQ
56-
* @param isInteraction
57-
*/
58-
public AnovaEffect( String effectName, Double pValue, Double fStatistic, Double degreesOfFreedom, Double ssQ,
59-
boolean isInteraction ) {
60-
super();
35+
private final double dof;
36+
private final String effectName;
37+
private final double fStat;
38+
private final boolean isInteraction;
39+
private final boolean isResiduals;
40+
private final double meanSq;
41+
private final double pValue;
42+
private final double ssQ;
43+
44+
public AnovaEffect( String effectName, double pValue, double fStat, double dof, double ssQ, boolean isInteraction, boolean isResiduals ) {
45+
if ( isResiduals && isInteraction ) {
46+
throw new IllegalArgumentException( "An ANOVA effect cannot be both a residual and an interaction." );
47+
}
6148
this.effectName = effectName;
6249
this.pValue = pValue;
63-
this.fStatistic = fStatistic;
64-
this.degreesOfFreedom = degreesOfFreedom;
50+
this.fStat = fStat;
51+
this.dof = dof;
6552
this.ssQ = ssQ;
66-
this.meanSq = ssQ / degreesOfFreedom;
53+
this.meanSq = ssQ / dof;
6754
this.isInteraction = isInteraction;
55+
this.isResiduals = isResiduals;
6856
}
6957

7058
/**
7159
* @return the degreesOfFreedom
7260
*/
73-
public Double getDegreesOfFreedom() {
74-
return degreesOfFreedom;
61+
public double getDof() {
62+
return dof;
7563
}
7664

7765
/**
@@ -84,28 +72,28 @@ public String getEffectName() {
8472
/**
8573
* @return the fStatistic
8674
*/
87-
public Double getFStatistic() {
88-
return fStatistic;
75+
public double getFStat() {
76+
return fStat;
8977
}
9078

9179
/**
9280
* @return the meanSq
9381
*/
94-
public Double getMeanSq() {
82+
public double getMeanSq() {
9583
return meanSq;
9684
}
9785

9886
/**
9987
* @return the pValue
10088
*/
101-
public Double getPValue() {
89+
public double getPValue() {
10290
return pValue;
10391
}
10492

10593
/**
10694
* @return the ssQ
10795
*/
108-
public Double getSsQ() {
96+
public double getSsQ() {
10997
return ssQ;
11098
}
11199

@@ -116,19 +104,21 @@ public boolean isInteraction() {
116104
return isInteraction;
117105
}
118106

107+
public boolean isResiduals() {
108+
return isResiduals;
109+
}
110+
119111
@Override
120112
public String toString() {
121113
StringBuilder buf = new StringBuilder();
122-
buf.append( StringUtils.rightPad( StringUtils.abbreviate( getEffectName(), 10 ), 10 ) + "\t" );
123-
buf.append( String.format( "%.2f", getDegreesOfFreedom() ) + "\t" );
124-
buf.append( String.format( "%.4f", getSsQ() ) + "\t" );
125-
buf.append( String.format( "%.4f", getMeanSq() ) + "\t" );
126-
127-
if ( fStatistic != null ) {
128-
buf.append( StringUtils.rightPad( String.format( "%.3f", getFStatistic() ), 6 ) + "\t" );
114+
buf.append( StringUtils.rightPad( StringUtils.abbreviate( getEffectName(), 10 ), 10 ) ).append( "\t" );
115+
buf.append( String.format( "%.2f", getDof() ) ).append( "\t" );
116+
buf.append( String.format( "%.4f", getSsQ() ) ).append( "\t" );
117+
buf.append( String.format( "%.4f", getMeanSq() ) ).append( "\t" );
118+
if ( !Double.isNaN( fStat ) ) {
119+
buf.append( StringUtils.rightPad( String.format( "%.3f", getFStat() ), 6 ) ).append( "\t" );
129120
buf.append( String.format( "%.3g", getPValue() ) );
130121
}
131122
return buf.toString();
132123
}
133-
134124
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The baseCode project
3+
*
4+
* Copyright (c) 2010 University of British Columbia
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*/
19+
package ubic.basecode.math.linearmodels;
20+
21+
import java.io.Serializable;
22+
23+
public interface AnovaResult extends Serializable {
24+
25+
/**
26+
* @return value used to track the identity of this
27+
*/
28+
String getKey();
29+
30+
boolean hasResiduals();
31+
32+
double getResidualsDof();
33+
34+
double getResidualsFStat();
35+
36+
double getResidualsPValue();
37+
}

0 commit comments

Comments
 (0)