Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–257 unchanged (257 lines)
258 * returned.
259 * </li></ul>
260 *
261 * @return sum of squared errors associated with the regression model
262 */
263 public double getSumSquaredErrors() {
264 return sumYY - sumXY * sumXY / sumXX;
265 }
266
267 /**
268 * Returns the sum of squared deviations of the y values about their mean.
269 * <p>
270 * This is defined as SSTO
…lines 271–520 unchanged (250 lines)

After

…lines 1–257 unchanged (257 lines)
258 * returned.
259 * </li></ul>
260 *
261 * @return sum of squared errors associated with the regression model
262 */
263 public double getSumSquaredErrors() {
264 return Math.max(0d, sumYY - sumXY * sumXY / sumXX);
265 }
266
267 /**
268 * Returns the sum of squared deviations of the y values about their mean.
269 * <p>
270 * This is defined as SSTO
…lines 271–520 unchanged (250 lines)

Before

program
block_comment "/*\n * Copyright 2003-2004 The Apache Software Foundation.\n *"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "stat"
. "."
identifier "regression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MathException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
. "."
identifier "DistributionFactory"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
. "."
identifier "TDistribution"
; ";"
block_comment "/**\n * Estimates an ordinary least squares regression model\n"...
class_declaration
modifiers
public "public"
class "class"
identifier "SimpleRegression"
super_interfaces
implements "implements"
type_list
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "3004689053607543335L"
; ";"
block_comment "/** sum of x values */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumX"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** total variation in x (sum of squared deviations from xba"...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumXX"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** sum of y values */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** total variation in y (sum of squared deviations from yba"...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumYY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** sum of products */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumXY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** number of observations */"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "n"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** mean of accumulated x values, used in updating formulas "...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "xbar"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** mean of accumulated y values, used in updating formulas "...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "ybar"
= "="
decimal_integer_literal "0"
; ";"
line_comment "// ---------------------Public methods----------------------"...
block_comment "/**\n * Create an empty SimpleRegression instance\n */"
constructor_declaration
modifiers
public "public"
identifier "SimpleRegression"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Adds the observation (x,y) to the regression data"...
method_declaration (+220 nodes collapsed)
block_comment "/**\n * Adds the observations represented by the elements"...
method_declaration (+73 nodes collapsed)
block_comment "/**\n * Clears all data from the model.\n */"
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Returns the number of observations that have been"...
method_declaration
modifiers
public "public"
integral_type
long "long"
identifier "getN"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "n"
; ";"
} "}"
block_comment "/**\n * Returns the \"predicted\" <code>y</code> value asso"...
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Returns the intercept of the estimated regression"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns the slope of the estimated regression line"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/SumOfS"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getSumSquaredErrors"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression
identifier "sumYY"
- "-"
binary_expression
binary_expression
identifier "sumXY"
* "*"
identifier "sumXY"
/ "/"
identifier "sumXX"
; ";"
} "}"
block_comment "/**\n * Returns the sum of squared deviations of the y va"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Returns the sum of squared deviations of the pred"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns the sum of squared errors divided by the "...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Returns <a href=\"http://mathworld.wolfram.com/Cor"...
method_declaration (+67 nodes collapsed)
block_comment "/** \n * Returns the <a href=\"http://www.xycoon.com/coeff"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/standa"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/stande"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Returns the half-width of a 95% confidence interv"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns the half-width of a (100-100*alpha)% conf"...
method_declaration (+74 nodes collapsed)
block_comment "/**\n * Returns the significance level of the slope (equi"...
method_declaration (+57 nodes collapsed)
line_comment "// ---------------------Private methods---------------------"...
block_comment "/**\n * Returns the intercept of the estimated regression "...
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Computes SSR from b1.\n * \n * @param slope"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Uses distribution framework to get a t distributi"...
method_declaration (+31 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2003-2004 The Apache Software Foundation.\n *"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "stat"
. "."
identifier "regression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MathException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
. "."
identifier "DistributionFactory"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
. "."
identifier "TDistribution"
; ";"
block_comment "/**\n * Estimates an ordinary least squares regression model\n"...
class_declaration
modifiers
public "public"
class "class"
identifier "SimpleRegression"
super_interfaces
implements "implements"
type_list
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "3004689053607543335L"
; ";"
block_comment "/** sum of x values */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumX"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** total variation in x (sum of squared deviations from xba"...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumXX"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** sum of y values */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** total variation in y (sum of squared deviations from yba"...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumYY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** sum of products */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "sumXY"
= "="
decimal_floating_point_literal "0d"
; ";"
block_comment "/** number of observations */"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "n"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** mean of accumulated x values, used in updating formulas "...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "xbar"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** mean of accumulated y values, used in updating formulas "...
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "ybar"
= "="
decimal_integer_literal "0"
; ";"
line_comment "// ---------------------Public methods----------------------"...
block_comment "/**\n * Create an empty SimpleRegression instance\n */"
constructor_declaration
modifiers
public "public"
identifier "SimpleRegression"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Adds the observation (x,y) to the regression data"...
method_declaration (+220 nodes collapsed)
block_comment "/**\n * Adds the observations represented by the elements"...
method_declaration (+73 nodes collapsed)
block_comment "/**\n * Clears all data from the model.\n */"
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Returns the number of observations that have been"...
method_declaration
modifiers
public "public"
integral_type
long "long"
identifier "getN"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "n"
; ";"
} "}"
block_comment "/**\n * Returns the \"predicted\" <code>y</code> value asso"...
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Returns the intercept of the estimated regression"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns the slope of the estimated regression line"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/SumOfS"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getSumSquaredErrors"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "Math"
. "."
identifier "max"
argument_list
( "("
decimal_floating_point_literal "0d"
, ","
binary_expression
identifier "sumYY"
- "-"
binary_expression
binary_expression
identifier "sumXY"
* "*"
identifier "sumXY"
/ "/"
identifier "sumXX"
) ")"
; ";"
} "}"
block_comment "/**\n * Returns the sum of squared deviations of the y va"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Returns the sum of squared deviations of the pred"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns the sum of squared errors divided by the "...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Returns <a href=\"http://mathworld.wolfram.com/Cor"...
method_declaration (+67 nodes collapsed)
block_comment "/** \n * Returns the <a href=\"http://www.xycoon.com/coeff"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/standa"...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Returns the <a href=\"http://www.xycoon.com/stande"...
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Returns the half-width of a 95% confidence interv"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns the half-width of a (100-100*alpha)% conf"...
method_declaration (+74 nodes collapsed)
block_comment "/**\n * Returns the significance level of the slope (equi"...
method_declaration (+57 nodes collapsed)
line_comment "// ---------------------Private methods---------------------"...
block_comment "/**\n * Returns the intercept of the estimated regression "...
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Computes SSR from b1.\n * \n * @param slope"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Uses distribution framework to get a t distributi"...
method_declaration (+31 nodes collapsed)
} "}"