SHARE
TWEET

Untitled

a guest Sep 13th, 2017 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data = RandomVariate[NormalDistribution[100, 30], 200];
  2. modData=ReplacePart[data,1->10^6];
  3.  
  4. Through@{Mean,StandardDeviation}@data
  5. (*{99.529,30.395}*)
  6.  
  7. Through@{Mean,StandardDeviation}@modData
  8. (*{5098.99,70703.6}*)
  9.  
  10. Through@{Median,SnDispersion}@modData
  11. (*{99.2765,31.6749}*)
  12.  
  13. Through@{LinearModelFit,GeneralizedLinearModelFit}[data,{},x]//Normal
  14. (*{99.529,99.529}*)
  15.  
  16. Through@{LinearModelFit,GeneralizedLinearModelFit}[modData,{},x]//Normal
  17. (*{5098.99,5098.99}*)
  18.  
  19. GeneralizedLinearModelFit[modData,{},x,DispersionEstimatorFunction->Function[{y,yhat,w},SnDispersion[y-yhat]]]//Normal
  20. (*5098.99*)
  21.  
  22. GeneralizedLinearModelFit[modData,{},x,DispersionEstimatorFunction->Function[{y,yhat,w},0]]//Normal
  23. (*5098.99*)
RAW Paste Data
Top