Class: Statsample::SEM

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/statsample/sem.rb,
lib/statsample/sem/model.rb,
lib/statsample/sem/openmxengine.rb,
lib/statsample/sem/semjfoxengine.rb

Defined Under Namespace

Classes: Model, OpenMxEngine, SemJFoxEngine

Constant Summary

VERSION =
'0.1.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = Hash.new, &block) ⇒ SEM

Returns a new instance of SEM



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/statsample/sem.rb', line 18

def initialize(opts=Hash.new, &block)
  default_opts={:name=>"SEM Analysis", :engine=>:sem}
  @opts=default_opts.merge(opts)
  @engine_obj=nil
  @name=@opts.delete :name
  @engine=@opts.delete :engine
  @model=Statsample::SEM::Model.new(:name=>@name)
  if block
    block.arity<1 ? instance_eval(&block) : block.call(self)
  end
end

Instance Attribute Details

#engineObject

Returns the value of attribute engine



15
16
17
# File 'lib/statsample/sem.rb', line 15

def engine
  @engine
end

#nameObject

Returns the value of attribute name



14
15
16
# File 'lib/statsample/sem.rb', line 14

def name
  @name
end

Instance Method Details

#computeObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/statsample/sem.rb', line 29

def compute
  @engine_obj=case @engine
  when :openmx
    OpenMxEngine.new(@model)
  when :sem
    SemJFoxEngine.new(@model)
  end
  @engine_obj.compute
  @engine_obj
end

#engine_objObject



39
40
41
# File 'lib/statsample/sem.rb', line 39

def engine_obj
  @engine_obj||=compute
end

#r_summaryObject



42
43
44
# File 'lib/statsample/sem.rb', line 42

def r_summary
  engine_obj.r_summary
end