Method: Statsample::Anova::Contrast#c

Defined in:
lib/statsample/anova/contrast.rb

#c(args = nil) ⇒ Object

Hypothesis contrast, using custom values Every parameter is a contrast value. You should use the same number of contrast as vectors on class and the sum of constrast should be 0.


44
45
46
47
48
49
50
51
# File 'lib/statsample/anova/contrast.rb', line 44

def c(args=nil)
  
  return @c if args.nil?
  @c=args
  raise "contrast number!=vector number" if args.size!=@vectors.size
  #raise "Sum should be 0" if args.inject(0) {|ac,v| ac+v}!=0
  @psi=args.size.times.inject(0) {|ac,i| ac+(args[i]*@vectors[i].mean)}
end