class Kot::Item4PL
An example of an Item class. You probably don't want to inherit from this, but instead to include {ItemResponseTheory} in a class of your own that provides {#a}, {#b}, {#c} and {#d}. See those attribute definitions for more information about what each parameter means in the context of correct/incorrect tests of ability.
This class is useful for simulating different CAT setups and is used for some of the specification tests of this library.
Attributes
a[R]
b[R]
c[R]
d[R]
Public Class Methods
[](*arr)
click to toggle source
@!attribute [r] d
Maximum likelihood of answering correctly. This describes the upper asymptote of the item's ICC, and so the highest probability of answering correctly regardless of ability. This parameter is more common in contexts outside of testing ability such as cognitive and clinical measures. Usually set to 1.0 for 1-3PL models. @return [Float] Insurmountable difficulty
# File lib/kot/item4pl.rb, line 63 def self.[](*arr) arr.map { |a| Item4PL.new(a) } end
gaussian(mean = 0.0, stddev = 1.0, rand = lambda{ Kernel.rand } )
click to toggle source
# File lib/kot/item4pl.rb, line 68 def self.gaussian(mean = 0.0, stddev = 1.0, rand = lambda{ Kernel.rand } ) theta = 2 * Math::PI * rand.call rho = Math.sqrt(-2 * Math.log(1 - rand.call)) scale = stddev * rho mean + scale * Math.cos(theta) end
generate(n = nil)
click to toggle source
@return [Item4PL] a 1PL Item4PL
with a {#b} chosen randomly from N(0,1) @return [Array] an array of 1PL Item4PLs with {#b}s chosen randomly from N(0,1)
# File lib/kot/item4pl.rb, line 77 def self.generate(n = nil) return Item4PL.new(b:gaussian()) if n.nil? Array.new(n) { generate } end
new(a: 1.0, b: 0.0, c: 0.0, d: 1.0)
click to toggle source
# File lib/kot/item4pl.rb, line 82 def initialize(a: 1.0, b: 0.0, c: 0.0, d: 1.0) @a = a @b = b @c = c @d = d end
Public Instance Methods
to_s()
click to toggle source
# File lib/kot/item4pl.rb, line 89 def to_s "<Item4PL a:#{a} b:#{b} c:#{c} d#{d} >" end