0
|
771 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# Standard deviation of residuals different from manual calculation

Posted 4 months ago
 Please can someone explain why pmSD1 and pmSD2 are different? p = Predict[{1.2, 2, 3.5, 4, 5.2} -> {2.3, 1.2, 5.5, 7.7, 9.9}]; pm = PredictorMeasurements[p, {1.4 -> 2.5, 4.5 -> 8.6, 5.4 -> 10.2, 3.3 -> 3}]; pmSD1 = pm["StandardDeviation"] pmSD2 = Sqrt[Total[pm["Residuals"]^2]/2] Information[p, "Method"] 
3 Replies
Sort By:
Posted 4 months ago
 Many Thanks Jim, also can you tell how the baseline is computed?
Posted 4 months ago
 The documentation states "StandardDeviationBaseline" standard deviation of test set values  And the formula used divides the sum of squares by the length of the test set values rather than the length of the test set values minus 1 (just as "StandardDeviation" does for a a PredictorMeasurementsObject).The documentation isn't always very explicit but it is the first place to start and trying examples can sometimes help one figure out what formulas are being used.
Posted 4 months ago
 pm["StandardDeviation"] uses the following formula: Sqrt[Total[pm["Residuals"]^2]/Length[pm["Residuals"]]] Here is a second example: p = Predict[{1 -> 2, 3 -> 4.5, 5 -> 6, 7 -> 8.5}]; pm = PredictorMeasurements[p, {1.5 -> 2, 4 -> 5, 6 -> 5.5}]; pm["StandardDeviation"] (* 1.12284 *) Sqrt[Total[pm["Residuals"]^2]/Length[pm["Residuals"]]] (* 1.12284 *)