Home

M†ŒŸo—˜_

‚QŽˆ‹­§‘I‘π‰Ϋ‘θ‚Ζ‚»‚ΜŠg’£”Ε

•]’θ–@ƒf[ƒ^‚ΜƒxƒCƒY•ͺΝ

‰ͺ–{ˆΐ°A2019.10A2023.05

 

@‚QŽˆ‹­§‘I‘πi2 alternative-forced-choice: 3AFCj‰Ϋ‘θ‚̏ꍇAƒmƒCƒYŽhŒƒ‚ΖƒVƒOƒiƒ‹ŽhŒƒ‚ͺŠeŽŽs‚Ι‚¨‚’‚Δ’ρŽ¦‚³‚κ‚ι‚ͺA‹σŠΤ“IˆΚ’u‚π•Ο‚¦‚āi‰E‚ƍΆA‚ ‚ι‚’‚͏γ‚Ζ‰Ί‚Ȃǁj“―Žž‚Ι’ρŽ¦‚³‚κ‚ικ‡A‚ ‚ι‚’‚Ν’ρŽ¦‚ΜŽžŠΤ‡˜‚π•Ο‚¦‚āi‘ζ‚PƒCƒ“ƒ^ƒoƒ‹‚Ζ‘ζ‚QƒCƒ“ƒ^ƒoƒ‹j’ρŽ¦‚³‚κ‚ικ‡‚ͺ‚ ‚ιB“Œvƒ‚ƒfƒ‹‚πl‚¦‚ι‚Ζ‚«‚́A‹σŠΤ‡˜‚ ‚ι‚’‚ΝŽžŠΤ‡˜‚Ι‚¨‚―‚ι‚Q‚Β‚ΜŽhŒƒ’ρŽ¦–@‚π‚Ζ‚ΰ‚ɁƒA„‚ ‚ι‚’‚́ƒA„‚Ε•\‚΅‚Δ‚ζ‚’BƒA„‚́AŽhŒƒ‚ͺ‹σŠΤˆΚ’u‚Ε’ρŽ¦‚³‚κ‚Δ‚’‚ι‚Ζ‚«‚́A—Ⴆ‚΁AΆ‘€‚ΙƒmƒCƒYŽhŒƒA‰E‘€‚ΙƒVƒOƒiƒ‹ŽhŒƒ‚ͺ’ρŽ¦‚³‚κ‚ι‚±‚Ζ‚π•\‚΅AŽžŠΤ‡˜‚Μ‚Ζ‚«‚Ν‘ζ‚PƒCƒ“ƒ^ƒoƒ‹‚ΕƒmƒCƒYŽhŒƒ‚ͺ’ρŽ¦‚³‚κA‘ζ‚QƒCƒ“ƒ^ƒoƒ‹‚ΕƒVƒOƒiƒ‹ŽhŒƒ‚ͺ’ρŽ¦‚³‚κ‚ι‚±‚Ζ‚π•\‚·BƒA„‚Μ‚Ζ‚«‚́A‡˜‚ͺ‹t‚Ι‚Θ‚ιBˆΘŒγ‚Μΰ–Ύ‚ł́A—Ⴆ‚΁ƒA„‚́A‚Ν‘ζ‚PˆΚ’uA‚Ν‘ζ‚QˆΚ’u‚Ι’ρŽ¦‚³‚κ‚ιπŒ‚π•\‚·‚Ζ‚’‚€‚±‚Ζ‚Ι‚·‚ιBŽhŒƒ’ρŽ¦πŒ•Κ‚Ι”»’fi”½‰žj‚π•ͺ—ή‚·‚ι‚Ζ•\1‚Μ‚ζ‚€‚Ι‚Θ‚ιB

 

•\1@2AFC‰Ϋ‘θ‚Ι‚¨‚―‚ιŽhŒƒ’ρŽ¦πŒ‚Ζ”½‰ži”»’fjB

 

ƒVƒOƒiƒ‹ŽhŒƒ‚Μ’ρŽ¦ˆΚ’u‚Ζ‚΅‚Δ”»’f‚³‚κ‚½ˆΚ’u

 

‘ζ‚PˆΚ’u

‘ζ‚QˆΚ’u

ƒA„

Œλ”½‰ž

³”½‰ž

ƒA„

³”½‰ž

Œλ”½‰ž

 

@‚’‚܁A1AFC‰Ϋ‘θ‚Μƒ‚ƒfƒ‹‚Ζ“―‚Ά‚­AƒmƒCƒYŽhŒƒ‚ΜŠ΄Šo‚ͺ•½‹Ο‚OA•ͺŽU‚P‚̐³‹K•ͺ•z‚ɏ]‚’AƒVƒOƒiƒ‹ŽhŒƒ‚ΜŠ΄Šo‚ͺ•½‹ΟA•ͺŽU‚̐³‹K•ͺ•z‚ɏ]‚€‚ΰ‚Μ‚Ζ‚·‚ιi“™•ͺŽUƒKƒEƒXŒ^ƒ‚ƒfƒ‹jB‚·‚Θ‚ν‚ΏA

A@

‚Ε‚ ‚ιB

@’ρŽ¦πŒƒA„‚¨‚ζ‚сƒA„‚Ι‚¨‚’‚čPνŒλ·‚¨‚ζ‚ΡˆΚ’u‘I‘πƒoƒCƒAƒX‚πl‚¦‚ιBPνŒλ·‚́AŽžŠΤŒλ·‚ ‚ι‚’‚Ν‹σŠΤŒλ·‚π•\‚·BˆΚ’u‘I‘πƒoƒCƒAƒX‚́AŠ΄Šo‚Μˆα‚’‚Μ•Ω•Κ‚Ζ‚Ν•Κ‚Ι‘ζ‚PˆΚ’u‚ ‚ι‚’‚Ν‘ζ‚QˆΚ’u‚Μ‘I‘π‚πD‚ήŒXŒό‚π•\‚·B‚±‚κ‚η‚ΜƒoƒCƒAƒX‚π‚ά‚Ζ‚ί‚Δ

‚Ζ‚¨‚«A‘ζ‚QˆΚ’u‚πŠξ€‚Ι‚΅‚½‘ζ‚PˆΚ’u‚Φ‚ΜƒoƒCƒAƒXŒψ‰Κ‚Ζ‚΅‚Δ•\‚·‚ƁAŠ΄Šo‚¨‚ζ‚Ρ‚Μ•ͺ•z‚ΝˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚ιB

ŽhŒƒ’ρŽ¦‚ͺƒA„‚Μ‚Ζ‚«A

A@

‚Ε—^‚¦‚η‚κA

‚Ζ‚Θ‚ιB

ŽhŒƒ’ρŽ¦‚ͺƒA„‚Μ‚Ζ‚«A

A@

‚Ε—^‚¦‚η‚κA

‚Ζ‚Θ‚ιB

@•]’θ–@‚Ι‚¨‚―‚ι”»’fƒJƒeƒSƒŠ‚Μ‹«ŠE’liŠξ€’lj‚π‚Ζ‚¨‚­B‚·‚Θ‚ν‚ΏAƒVƒOƒiƒ‹ŽhŒƒ‚ΜŠ΄Šo‚ΖƒmƒCƒYŽhŒƒ‚ΜŠ΄Šo‚̍·‚ͺ‚Ζ‚ΜŠΤ‚Ι‚ ‚ι‚Ζ‚«ƒJƒeƒSƒŠ‚Μ”»’f‚Ι‚Θ‚ι‚ƍl‚¦‚ιB

‚Μ‚Ζ‚«

ŠΟŽ@Ž‚Μ”»’fƒJƒeƒSƒŠ

‚Ε‚ ‚ιB

@”»’fƒJƒeƒSƒŠ‚Μ‘”‚ͺ‚SƒJƒeƒSƒŠ‚Μ‚Ζ‚«A—Ⴆ‚Ξ”»’fƒJƒeƒSƒŠ‚ΝŽŸ‚Μ‚ζ‚€‚Ι‚Θ‚ιB‚±‚±‚ŁA‚Μ’l‚́AƒVƒOƒiƒ‹ŽhŒƒ‚ΜŠ΄Šo‚ͺ‹­‚’‚Ω‚ΗƒJƒeƒSƒŠ‚Μ’l‚Ν‘ε‚«‚’’l‚Ι‚Θ‚ι‚ͺAƒA„‚ƁƒA„‚Ε‚ΝƒVƒOƒiƒ‹ŽhŒƒ‚Μ’ρŽ¦ˆΚ’u‚ͺˆΩ‚Θ‚ι‚±‚Ζ‚Ι’ˆΣB

ƒA„‚Μ‚Ζ‚«A

ƒJƒeƒSƒŠ‚PF@ƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚QF@ƒVƒOƒiƒ‹‚Ν‘½•ͺ‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚RF@ƒVƒOƒiƒ‹‚Ν‘½•ͺ‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚SF@ƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

ƒA„‚Μ‚Ζ‚«A

ƒJƒeƒSƒŠ‚PF@ƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚QF@ƒVƒOƒiƒ‹‚Ν‘½•ͺ‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚RF@ƒVƒOƒiƒ‹‚Ν‘½•ͺ‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

ƒJƒeƒSƒŠ‚SF@ƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

 

@‚’‚܁A”»’fƒJƒeƒSƒŠ‚Μ‘”‚π‚Ζ‚¨‚’‚½‚Ζ‚«AƒJƒeƒSƒŠ‹«ŠE‚π

‚Ζ‚¨‚­B—ݐϕW€³‹K•ͺ•zŠΦ”‚Ι‘Ξ‚΅‚Δ

A@

‚Ζ‚¨‚’‚½‚Ζ‚«A”»’fƒJƒeƒSƒŠ‚ͺƒJƒeƒSƒŠ‚Ε‚ ‚ιŠm—¦‚ΝŽŸ‚Μ‚ζ‚€‚Ι—^‚¦‚η‚κ‚ιB

ƒA„‚Μ‚Ζ‚«AƒJƒeƒSƒŠ‚Ε‚ ‚ιŠm—¦‚́AŽi‚Pj‚ζ‚θ

‚Ζ‚Θ‚ιB

ƒA„‚Μ‚Ζ‚«AƒJƒeƒSƒŠ‚Ε‚ ‚ιŠm—¦‚́AŽi‚Qj‚ζ‚θ

‚Ζ‚Θ‚ιB

 

•\2@ŽhŒƒ’ρŽ¦πŒ‚Ι‘Ξ‚·‚ιƒJƒeƒSƒŠ•]’θ”»’f‚Μ•p“xB

 

ƒJƒeƒSƒŠ‚P

EEE

ƒJƒeƒSƒŠk

EEE

ƒJƒeƒSƒŠK

ƒA„

EEE

EEE

ƒA„

EEE

EEE

 

@ŠeŽhŒƒ’ρŽ¦πŒ‚Ι‘Ξ‚·‚ιƒJƒeƒSƒŠ”»’f‚Μ•p“x‚ͺ•\2‚Μ‚ζ‚€‚Ε‚ ‚ι‚Ζ‚«A–ή“xŠΦ”‚ΝŽŸŽ‚Ε—^‚¦‚η‚κ‚ιB

@ƒ‚ƒfƒ‹‚Μƒpƒ‰ƒ[ƒ^‚̐”‚Ν

‚Ε‚ ‚ι‚ͺAŽi‚Rj‚¨‚ζ‚ΡŽi‚Sj‚ΜŠΦ”‚Μˆψ”‚Μ•ͺ”Œ`‚©‚ηˆΘ‰Ί‚Μ‚ζ‚€‚Θƒpƒ‰ƒ[ƒ^’l‚Μ•s’萫‚ͺ”F‚ί‚η‚κ‚ιB

@•ͺ”‚Μ•ͺ•κŽq‚Ι“―‚Ά”‚πŠ|‚―‚Δ‚ΰ’l‚Ν•Ο‚ν‚η‚Θ‚’‚̂ŁA•ͺ•κ‚Μ’l‚π‚Ζ‚¨‚’‚Δ‚ΰˆκ”ʐ«‚ΝŽΈ‚ν‚κ‚Θ‚’B‚±‚κ‚́A“™•ͺŽUƒ‚ƒfƒ‹ij‚ ‚ι‚’‚Ν‚ζ‚θˆκ”Κ“I‚Ι‚ΝŠ΄Šo‚Μ’PˆΚ‚π‚Ε‚ ‚ι‚ζ‚€‚ɐݒ肷‚ι‚Ζ‚’‚€‚±‚Ζ‚Ε‚ ‚ιB

‚΅‚©‚΅ABrady et al. (2023; https://link.springer.com/article/10.3758/s13423-022-02179-w)‚́A‹L‰―‚ΜƒpƒtƒH[ƒ}ƒ“ƒX‚ΜŒ€‹†‚Ι‚¨‚’‚Δ‚Ν‚QAFC‚π—p‚’‚ι‚±‚Ƃ𐄏§‚΅‚Δ‚’‚ι‚ͺA‚³‚η‚ɁA•s“™•ͺŽUƒ‚ƒfƒ‹‚ͺROC‹Θό‚Ι‚ζ‚­‡‚€‚Ζΰ–Ύ‚΅‚Δ‚’‚ιip. 442jB2AFC‚πŠg’£‚΅‚Δ•s“™•ͺŽUƒ‚ƒfƒ‹‚ͺ“K—p‚Ε‚«‚ι‚ζ‚€‚ɍH•v‚³‚κ‚½ŽΐŒ±–@‚Ζ•ͺΝƒ‚ƒfƒ‹‚ͺ’ρˆΔ‚³‚κ‚Δ‚’‚ιihttps://osf.io/ts2eq/jB•s“™•ͺŽU‚ͺ—\‘z‚³‚κ‚ικ‡‚́A‚±‚ΜŠg’£2Žˆ‹­§‘I‘π•]’θ–@‚π—p‚’‚ι‚Χ‚«‚Ε‚ ‚λ‚€BŠg’£”Ε‚Ι‚Β‚’‚ẮA–{ƒEƒFƒuƒTƒCƒg‚ΜŒγ”Ό‚Εΰ–Ύ‚΅‚½B

 

•W€‚Μ‚QAFC‰Ϋ‘θ‚Ι‚Β‚’‚Δ‹c˜_‚𑱂―‚ιB

‚±‚̏ꍇ‚́A“™•ͺŽUƒ‚ƒfƒ‹‚ōl‚¦‚ι‚ͺAŠ΄Šo‚Μ•Ω•Κ—Ν‚Ν

‚Ζ•\‹L‚³‚κ‚ιB

@‚ά‚½A•ͺŽq‚Ι‚¨‚―‚ι‚Ζ‚Ι“―‚Ά’萔‚π‰Α‚¦‚Δ‚ΰ

‚Ε‚ ‚ι‚̂ŁAƒpƒ‰ƒ[ƒ^’l‚πŒˆ‚ί‚ι‚½‚߂ɂ͐§–ρπŒ‚ͺ•K—v‚Ε‚ ‚ιBŠ΄Šo‚̍·‚Μ”»’f‚ͺŒ΄“_‚ΙŠΦ‚΅‚đΏ̂ł ‚ι‚Ζ‚·‚ι‚ƁA‚±‚κ‚ΝƒJƒeƒSƒŠ‹«ŠE‚ΙŽŸ‚Μ‰Ό’θ‚π‚¨‚­‚±‚Ζ‚Ε‚ ‚ιB

@ƒJƒeƒSƒŠ”‚ͺ‹τ”i@Ž©‘R”j‚Μ‚Ζ‚«

@‚±‚Μ‚Ζ‚«Aƒ‚ƒfƒ‹‚Μƒpƒ‰ƒ[ƒ^‚ΜŽ©—R“x‚Ν

‚Ζ‚Θ‚ιB

@ƒJƒeƒSƒŠ”‚ͺŠο”i@Ž©‘R”j‚Μ‚Ζ‚«

@‚±‚Μ‚Ζ‚«Aƒ‚ƒfƒ‹‚Μƒpƒ‰ƒ[ƒ^‚ΜŽ©—R“x‚Ν

‚Ζ‚Θ‚ιB

@•\2‚Μƒf[ƒ^‚ΜŽ©—R“x‚́A•\2‚Μƒf[ƒ^‚πŽhŒƒ’ρŽ¦πŒ‚Ι‚¨‚―‚ι•p“x‚Μ”δ—¦ƒf[ƒ^‚ƍl‚¦‚κ‚Ξ

‚Ζ‚Θ‚ιBƒpƒ‰ƒ[ƒ^‚̐„’θ‚ͺ•s’θ‚Ζ‚Θ‚η‚Θ‚’‚½‚߂ɂ́Aƒpƒ‰ƒ[ƒ^‚ΜŽ©—R“x‚Νƒf[ƒ^‚ΜŽ©—R“xˆΘ‰Ί‚Ε‚Θ‚―‚κ‚Ξ‚Θ‚η‚Θ‚’B‚·‚Θ‚ν‚ΏA

‚Ε‚ ‚ι‚ͺA‚±‚ΜπŒ‚Ν–ž‚½‚³‚κ‚Δ‚’‚ιB

 

γ‹L‚Μƒ‚ƒfƒ‹‚ΙŠξ‚Γ‚­ƒxƒCƒY•ͺΝ‚Μ‚½‚ί‚ΜStanƒXƒNƒŠƒvƒg‚Ζ‚»‚κ‚π—p‚’‚ιPythonƒXƒNƒŠƒvƒg‚πAK‚Qi•W€“I‚Θ‚QAFC‰Ϋ‘θjAK‚ͺŠο”AK‚ͺ‚SˆΘγ‚Μ‹τ”‚Μ‚R‚‚̏ꍇ‚Ι•ͺ‚―‚č쐬‚΅‚Δ‚έ‚½B‚Θ‚¨APython—p‚ΜStaniPyStanj‚Ι‚Β‚’‚ẮAΩ’˜ƒ‰ͺ–{ˆΐ°u‚’‚ά‚³‚η•·‚―‚Θ‚’Python‚Εƒf[ƒ^•ͺΝvŠΫ‘Po”Ł„‚Εΰ–Ύ‚΅‚Δ‚’‚ιBM†ŒŸo—˜_‚ΜŠξ‘b“I‚Θΰ–Ύ‚πΩ’˜ƒ‰ͺ–{ˆΐ°uS—Šwƒf[ƒ^•ͺΝ‚Ζ‘ͺ’θv™€‘‘–[„‚ ‚ι‚’‚́ƒ‰ͺ–{ˆΐ°uŒv—ʐS—Šwv”|•—ŠΩ„‚ōs‚Α‚Δ‚’‚ιB

 

K=2‚̏ꍇi•W€“I‚Θ‚QAFC‰Ϋ‘θj

StanƒXƒNƒŠƒvƒgƒŠƒXƒgA.1‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgA.1@K=2‚̏ꍇ‚ΜStanƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFC2Cat.stanj

data {

    int n_NS[2];

    int n_SN[2];

}

parameters {

    real mu_s;

    real tau;

}

transformed parameters {

    simplex[2] p_NS;

    simplex[2] p_SN;

    p_NS[1] = Phi(-(mu_s - tau)/sqrt(2.0));

    p_NS[2] = 1 - p_NS[1];

    p_SN[1] = Phi(-(mu_s + tau)/sqrt(2.0));

    p_SN[2] = 1 - p_SN[1];

}

model {

    mu_s ~ normal(0.0, 100.0);

    tau ~ normal(0.0, 100.0);

    n_NS ~ multinomial(p_NS);

    n_SN ~ multinomial(p_SN);

}

 

ƒŠƒXƒgA.1‚ΜStanƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹SDT2AFC2Cat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒg‚πAƒŠƒXƒgA.2‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgA.2@StanƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹SDT2AFC2Cat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFC2Cat.pyj

import numpy as np

import pystan

import matplotlib.pyplot as plt

import csv

 

flnm = input('“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό(*.csv) = ')

with open(flnm, 'r') as f:

    data = [v for v in csv.reader(f)]

 

fout_nm = input('o—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό(*.txt) = ')

fout = open(fout_nm, 'w')

fout.write('Input Data File = {}\n'.format(flnm))

   

Freq_NS = []

Freq_NS.append(int(data[1][1]))

Freq_NS.append(int(data[1][2]))

Freq_SN = []

Freq_SN.append(int(data[2][1]))

Freq_SN.append(int(data[2][2]))

print(Freq_NS)

print(Freq_SN)

fout.write('<N, S>: {}'.format(Freq_NS))

fout.write('\n<S, N>: {}'.format(Freq_SN))

TN_NS = sum(Freq_NS)

Rating_NS = []

Rating_NS.append(Freq_NS[0])

Rating_NS.append(Freq_NS[1])

 

TN_SN = sum(Freq_SN)

Rating_SN = []

Rating_SN.append(TN_SN - Freq_SN[0])

Rating_SN.append(TN_SN - Freq_SN[1])

 

Data = {'n_NS': Rating_NS, 'n_SN': Rating_SN}

 

sm = pystan.StanModel(file = 'SDT2AFC2Cat.stan')

 

fit = sm.sampling(data = Data, n_jobs = 1)

 

print(fit)

fout.write('\n{}\n'.format(fit))

 

mu = fit['mu_s']

tau = fit['tau']

p_NS = fit['p_NS']

p_SN = fit['p_SN']

 

mu_L05 = np.percentile(mu, 5)

mu_med = np.percentile(mu, 50)

mu_U95 = np.percentile(mu, 95)

fout.write("\nd': \nMed. = {0:<.3f},  90%CI = [{1:<.3f}, {2:<.3f}".

           format(mu_med, mu_L05, mu_U95))

 

tau_L05 = np.percentile(tau, 5)

tau_med = np.percentile(tau, 50)

tau_U95 = np.percentile(tau, 95)

fout.write('\ntau: \nMed. = {0:<.3f},  90%CI ~ [{1:<.3f}, {2:<.3f}]'.

           format(tau_med, tau_L05, tau_U95))

 

p1 = np.median(p_NS, axis = 0)

p2 = np.median(p_SN, axis = 0)

p2 = [p2[1], p2[0]]

 

plt.hist(mu)

plt.xlabel("d'($\mu_S$)", fontsize = 14)

plt.title("Posterior Distribution of d'($\mu_S$)" + \

          '\nMed. = {0:<.3f},  90%CI = [{1:M<.3f}, {2:<.3f}]'.

          format(mu_med, mu_L05, mu_U95), fontsize = 16)

plt.show()

 

plt.hist(tau)

plt.xlabel(r'$\tau$', fontsize = 18)

plt.title(r'Posterior Distribution of $\tau$' + \

          '\nMed. = {0:<.3f},  90%CI = [{1:<.3f}, {2:<.3f}]'.

          format(tau_med, tau_L05, tau_U95), fontsize = 16)

plt.show()

 

xcat = [1, 2]

xlabels = ['Cat-1', 'Cat-2']

y1 = [Freq_NS[0]/TN_NS, Freq_NS[1]/TN_NS]

y2 = [Freq_SN[0]/TN_SN, Freq_SN[1]/TN_SN]

 

plt.plot(xcat, y1, 'b:', linewidth = 10, label = 'Data/<N, S>')

plt.plot(xcat, p1, 'g-', linewidth = 3, label = 'Model/<N, S>')

plt.plot(xcat, y2, 'r:', linewidth = 10, label = 'Data/<S, N>')

plt.plot(xcat, p2, 'm-', linewidth = 3,label = 'Model/<S, N>')

plt.xticks(xcat, xlabels, fontsize = 14)

plt.xlim(0.8, 2.2)

plt.xlabel('Rating Category', fontsize = 14)

plt.ylabel('Probability/Proportion', fontsize = 14)

plt.title('Rating in Conditions <N, S> and <S, N>', fontsize = 18)

plt.legend(loc = 'upper center', fontsize = 10)

plt.show()

     

fout.close()

print('\n' + fout_nm + ' was saved.\n')

 

ƒŠƒXƒgA.1‚ΖƒŠƒXƒgA.2‚Μƒtƒ@ƒCƒ‹‚¨‚ζ‚ΡƒTƒ“ƒvƒ‹ƒf[ƒ^ƒtƒ@ƒCƒ‹‚́A‚ά‚Ζ‚ί‚Δˆ³kƒtƒ@ƒCƒ‹Rating2Cat.zip‚Ζ‚΅‚½Bƒ_ƒEƒ“ƒ[ƒh‰π“€‚·‚κ‚΁AŽ©—R‚Ι—˜—p‚Ε‚«‚ιB

ƒŠƒXƒgA.2‚Μƒtƒ@ƒCƒ‹SDT2AFC2Cat.py‚πŽΐs‚·‚ι‚ƁA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚̐ݒθ‚ͺ‹‚ί‚η‚κ‚ιi}A.1jB

}A.1

 

o—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚Ν”CˆΣ‚ΜƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Όiƒtƒ@ƒCƒ‹Šg’£Žq.txtj‚Ε‚ ‚ι‚ͺA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚ΝCSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Đ}A.2‚Μ—lŽ‚Ε—pˆΣ‚·‚ιB

}A.2@ƒf[ƒ^ƒtƒ@ƒCƒ‹Data2Cat.csv

 

‘ζ‚Ps–ڂ͕ϐ”–Ό‚Μ–Ό‘O‚πέ’θ‚·‚ι‚ͺAƒvƒƒOƒ‰ƒ€‚Ε‚Ν—p‚’‚Θ‚’‚Μ‚Ε”CˆΣ‚Μ•ΆŽš—ρ‚Ε‚ζ‚’B‚½‚Ύ‚΅A‘ζ‚Ps–Ϊ‘ζ‚P—ρ–Ϊ‚Ι•ΆŽš—ρID‚πέ’θ‚·‚ι‚ƁAExcel‚̏ꍇA“ǂݍž‚έŽž‚ΙƒGƒ‰[ƒƒbƒZ[ƒW‚ͺ•\Ž¦‚³‚κ‚ι‚±‚Ζ‚ͺ‚ ‚ι‚ͺA‚±‚κ‚Ν–³Ž‹‚·‚ιB‘ζ‚Qs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒNAS>i—Ⴆ‚΁AΆ‚ΙƒmƒCƒYŽhŒƒA‰E‚ΙƒVƒOƒiƒ‹ŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Rs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒSAN„i—Ⴆ‚΁AΆ‚ΙƒVƒOƒiƒ‹ŽhŒƒA‰E‚ΙƒmƒCƒYŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Qs–ځA‘ζ‚Rs–Ϊ‚Ζ‚ΰA‘ζ‚Q—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιi—Ⴆ‚΁AƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιi—Ⴆ‚΁AƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚Ε‚ ‚ιBƒf[ƒ^‚̐ݒθ‚ͺI‚ν‚κ‚΁Aƒtƒ@ƒCƒ‹Šg’£Žq‚Ζ‚΅‚āu.csvv‚π‘I‚ρ‚Ε•Ϋ‘Ά‚·‚ι‚ƁACSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Δ•Ϋ‘Ά‚³‚κ‚ιB

}A.1‚Μ‚ζ‚€‚Ι“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ι‚ƁAŒvŽZ‚ͺŽn‚ά‚ιBStan‚Ι‚ζ‚ιƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚Έij‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}A.3jB

}A.3

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=1.075A90“CI‚ͺ[0.850, 1.316]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}A.3‚Μ‚Σ‚§‚ή‚π•Β‚Ά‚ι‚ƁAƒΡ‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}A.4jB

}A.4

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=0.335A90“CI‚ͺ[0.106, 0.579]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}A.4‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦^”δ—¦‚πŽ¦‚·ƒOƒ‰ƒt‚ͺά‚κόƒOƒ‰ƒt‚Ε•\Ž¦‚³‚κ‚ιi}A.5jB

}A.5

 

ƒf[ƒ^‚ͺ”jό‚Ε”δ—¦‚π•\‚΅Aƒ‚ƒfƒ‹‚ͺŽΐό‚ΕŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦‚Μ’†‰›’l‚Ε‚ ‚ιBuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuCat-1v‚ŁAuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuCat-2v‚Ε•\‚³‚κ‚Δ‚’‚ιB

}A.5‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚ΜŽΐsI—Ή‚Ζ‚Θ‚ιBŽΐsI—ΉŒγAo—Νƒtƒ@ƒCƒ‹‚π“K“–‚ΘƒGƒfƒBƒ^‚ΕŠJ‚­‚ƁAˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

Input Data File = Data2Cat.csv

<N, S>: [30, 70]

<S, N>: [84, 16]

Inference for Stan model: anon_model_76fee9688e040eaa9d47a70bb9cf69e2.

4 chains, each with iter=2000; warmup=1000; thin=1;

post-warmup draws per chain=1000, total post-warmup draws=4000.

 

          mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat

mu_s      1.08  2.6e-3   0.14    0.8   0.99   1.08   1.18   1.37   3058    1.0

tau       0.34  2.3e-3   0.14   0.06   0.24   0.34   0.43   0.62   3648    1.0

p_NS[0]    0.3  7.2e-4   0.05   0.22   0.27    0.3   0.33   0.39   4000    1.0

p_NS[1]    0.7  7.2e-4   0.05   0.61   0.67    0.7   0.73   0.78   4000    1.0

p_SN[0]   0.16  6.8e-4   0.04    0.1   0.13   0.16   0.18   0.24   2877    1.0

p_SN[1]   0.84  6.8e-4   0.04   0.76   0.82   0.84   0.87    0.9   2877    1.0

lp__    -106.0    0.02   1.04 -108.7 -106.4 -105.7 -105.3 -105.0   1800    1.0

 

Samples were drawn using NUTS at Tue Oct 22 10:30:19 2019.

For each parameter, n_eff is a crude measure of effective sample size,

and Rhat is the potential scale reduction factor on split chains (at

convergence, Rhat=1).

 

d':

Med. = 1.082,  90%CI = [0.847, 1.320

tau:

Med. = 0.339,  90%CI ~ [0.105, 0.577]

 

 

K‚ͺŠο”‚̏ꍇ

”»’f‚ΜƒJƒeƒSƒŠ”K‚ͺŠο”‚̏ꍇ‚ΜStanƒXƒNƒŠƒvƒg‚πƒŠƒXƒgB.1‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgB.1@K‚ͺŠο”‚̏ꍇ‚ΜStanƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFCOddCat.stanj

functions {

    real half_normal_lpdf(real y, real sgm){

        if (y > 0.0){

            return normal_lpdf(y | 0.0, sgm);

        } else {

            return log(0.0);

        }

    }

}

data {

    int K;

    int n_NS[K];

    int n_SN[K];

}

 

parameters {

    real mu_s;

    real tau;

    real<lower = 0.0> theta[(K - 1) / 2];

}

transformed parameters {

    real C[K - 1];

    simplex[K] p_NS;

    simplex[K] p_SN;

    C[(K - 1) / 2 + 1] = theta[1];

    C[(K - 1) / 2] = -C[(K - 1) / 2 + 1];

    for (k in 2: ((K - 1) / 2)){

        C[(K - 1) /2 + k] = C[(K - 1) / 2 + k - 1] + theta[k];

        C[(K - 1) / 2 - k + 1] = -C[(K - 1) / 2 + k];

    }

    p_NS[1] = Phi((C[1] - (mu_s - tau))/sqrt(2.0));

    p_NS[K] = 1 - Phi((C[K - 1] - (mu_s - tau))/sqrt(2.0));

 

    for (k in 2:(K-1)) {

        p_NS[k] = Phi((C[k] - (mu_s - tau))/sqrt(2.0)) -

                   Phi((C[k - 1] - (mu_s - tau))/sqrt(2.0));

    }

 

    p_SN[1] = Phi((C[1] - (mu_s + tau))/sqrt(2.0));

    p_SN[K] = 1 - Phi((C[K - 1] - (mu_s + tau))/sqrt(2.0));

   

    for (k in 2:(K-1)) {

        p_SN[k] = Phi((C[k] - (mu_s + tau))/sqrt(2.0)) -

                   Phi((C[k - 1] - (mu_s + tau))/sqrt(2.0));

    }

 

}

model {

    for (k in 1:((K - 1) / 2)) {

        theta[k] ~ half_normal(1000.0);

    }

    mu_s ~ normal(0.0, 100.0);

    tau ~ normal(0.0, 100.0);

    n_NS ~ multinomial(p_NS);

    n_SN ~ multinomial(p_SN);

}

 

ƒŠƒXƒgB.1‚ΜStanƒXƒNƒŠƒvƒgSDT2AFCOddCat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒg‚πAƒŠƒXƒgB.2‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgB.2@StanƒXƒNƒŠƒvƒgSDT2AFCOddCat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFCOddCat.pyj

import numpy as np

import pystan

import matplotlib.pyplot as plt

import csv

 

flnm = input('“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹(*.csv) = ')

with open(flnm, 'r') as f:

    data = [v for v in csv.reader(f)]

fout_nm = input('o—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό = ')

fout = open(fout_nm, 'w')

fout.write('\nInput Data File = {}\n'.format(flnm))

 

K = len(data[0]) - 1

print('K = ', K)

if (K % 2) == 0:

    print('ƒJƒeƒSƒŠ” K ‚ΝŠο”‚Ε‚Θ‚―‚κ‚Ξ‚Θ‚η‚Θ‚’I')

    import sys

    sys.exit()

   

Freq_NS = []

for k in range(K):

    Freq_NS.append(int(data[1][1 + k]))

Freq_SN = []

for k in range(K):

    Freq_SN.append(int(data[2][1 + k]))

print(Freq_NS)

print(Freq_SN)

fout.write('\n<N, S>\n{}\n'.format(Freq_NS))

fout.write('\n<S, N>\n{}\n'.format(Freq_SN))          

TN_NS = sum(Freq_NS)

Rating_NS = Freq_NS

TN_SN = sum(Freq_SN)

Rating_SN = []

for k in range(K):

    Rating_SN.append(Freq_SN[K - 1 - k])

 

 

Data = {'K': K, 'n_NS': Rating_NS, 'n_SN': Rating_SN}

 

sm = pystan.StanModel(file = 'SDT2AFCOddCat.stan')

 

fit = sm.sampling(data = Data, n_jobs = 1)

 

print(fit)

fout.write('\n{}\n'.format(fit))

 

mu = fit['mu_s']

tau = fit['tau']

C = fit['C']

p_NS = fit['p_NS']

p_SN = fit['p_SN']

 

mu_L05 = np.percentile(mu, 5)

mu_med = np.percentile(mu, 50)

mu_U95 = np.percentile(mu, 95)

fout.write("\nd':\nMedian = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]\n".

           format(mu_med, mu_L05, mu_U95))

 

 

tau_L05 = np.percentile(tau, 5)

tau_med = np.percentile(tau, 50)

tau_U95 = np.percentile(tau, 95)

fout.write('\ntau:\nMedian = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]\n'.

           format(tau_med, tau_L05, tau_U95))

 

C_L05 = np.zeros(K-1)

C_med = np.zeros(K-1)

C_U95 = np.zeros(K-1)

for k in range(K-1):

    C_L05[k] = np.percentile(C.T[k], 5)

    C_med[k] = np.percentile(C.T[k], 50)

    C_U95[k] = np.percentile(C.T[k], 95)

for k in range(K-1):

    fout.write(('\nC[{0}]:\n' + \

               'Median = {1:<.3f},   90%CI = [{2:<.3f}, {3:<.3f}]\n').

               format(k+1, C_med[k], C_L05[k], C_U95[k]))

 

plt.hist(mu)

plt.xlabel("d'($\mu_S$)", fontsize = 14)

plt.title("Posterior Distribution of d'($\mu_S$)" + \

          '\nMed. = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]'.

          format(mu_med, mu_L05, mu_U95), fontsize = 16)

plt.show()

 

plt.hist(tau)

plt.xlabel(r'$\tau$', fontsize = 18)

plt.title(r'Posterior Distribution of $\tau$' + \

          '\nMed. = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]'.

          format(tau_med, tau_L05, tau_U95), fontsize = 16)

plt.show()

 

for k in range(K-1):

    plt.hist(C.T[k], label = 'C{}'.format(k+1))

plt.title('Posterior Distributions of Category Boundaries', fontsize = 18)

plt.legend()

plt.show()

 

p1 = np.median(p_NS, axis = 0)

p2 = np.median(p_SN, axis = 0)

p2 = np.flip(p2)

 

xcat = np.arange(1, K+0.1, 1)

xlabels = ['{}'.format(int(v)) for v in xcat]

y1 = []

y2 = []

for k in range(K):

    y1.append(Freq_NS[k]/TN_NS)

    y2.append(Freq_SN[k]/TN_SN)

   

plt.plot(xcat, y1, 'b--', linewidth = 3, alpha = 0.7, label = 'Data/<N, S>')

plt.plot(xcat, p1, 'g-', linewidth = 3, alpha = 0.7, label = 'Model/<N, S>')

plt.plot(xcat, y2, 'r--', linewidth = 3, alpha = 0.7, label = 'Data/<S, N>')

plt.plot(xcat, p2, 'm-', linewidth = 3, alpha = 0.7, label = 'Model/<S, N>')

 

plt.xticks(xcat, xlabels, fontsize = 14)

plt.xlabel('Rating Category', fontsize = 14)

plt.ylabel('Probability/Proportion', fontsize = 14)

plt.title('Ratings in Conditions <N, S> and <S, N>', fontsize = 18)

plt.legend(loc = 'upper center', fontsize = 10)

plt.show()

 

fout.close()

print('\n{} was saved.\n'.format(fout_nm))

 

ƒŠƒXƒgB.1‚ΖƒŠƒXƒgB.2‚Μƒtƒ@ƒCƒ‹‚¨‚ζ‚ΡƒTƒ“ƒvƒ‹ƒf[ƒ^ƒtƒ@ƒCƒ‹‚́A‚ά‚Ζ‚ί‚Δˆ³kƒtƒ@ƒCƒ‹RatingOddCat.zip‚Ζ‚΅‚½Bƒ_ƒEƒ“ƒ[ƒh‰π“€‚·‚κ‚΁AŽ©—R‚Ι—˜—p‚Ε‚«‚ιB

ƒŠƒXƒgB.2‚Μƒtƒ@ƒCƒ‹SDT2AFCOddCat.py‚πŽΐs‚·‚ι‚ƁA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚̐ݒθ‚ͺ‹‚ί‚η‚κ‚ιi}B.1jB

}B.1

 

o—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚Ν”CˆΣ‚ΜƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Όiƒtƒ@ƒCƒ‹Šg’£Žq.txtj‚Ε‚ ‚ι‚ͺA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚ΝCSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Đ}B.2‚Μ—lŽ‚Ε—pˆΣ‚·‚ιB

}B.2@ƒf[ƒ^ƒtƒ@ƒCƒ‹Data3Cat.csv

 

‘ζ‚Ps–ڂ͕ϐ”–Ό‚Μ–Ό‘O‚πέ’θ‚·‚ι‚ͺAƒvƒƒOƒ‰ƒ€‚Ε‚Ν—p‚’‚Θ‚’‚Μ‚Ε”CˆΣ‚Μ•ΆŽš—ρ‚Ε‚ζ‚’B‚½‚Ύ‚΅A‘ζ‚Ps–Ϊ‘ζ‚P—ρ–Ϊ‚Ι•ΆŽš—ρID‚πέ’θ‚·‚ι‚ƁAExcel‚̏ꍇA“ǂݍž‚έŽž‚ΙƒGƒ‰[ƒƒbƒZ[ƒW‚ͺ•\Ž¦‚³‚κ‚ι‚±‚Ζ‚ͺ‚ ‚ι‚ͺA‚±‚κ‚Ν–³Ž‹‚·‚ιB‘ζ‚Qs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒNAS>i—Ⴆ‚΁AΆ‚ΙƒmƒCƒYŽhŒƒA‰E‚ΙƒVƒOƒiƒ‹ŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂɁu‚ν‚©‚η‚Θ‚’v‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚S—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Rs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒSAN„i—Ⴆ‚΁AΆ‚ΙƒVƒOƒiƒ‹ŽhŒƒA‰E‚ΙƒmƒCƒYŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ3—ρ–ڂɁu‚ν‚©‚η‚Θ‚’vA‘ζ‚S—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Qs–ځA‘ζ‚Rs–Ϊ‚Ζ‚ΰA‘ζ‚Q—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιi—Ⴆ‚΁AƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂ́u‚ν‚©‚η‚Θ‚’vA‘ζ‚S—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιi—Ⴆ‚΁AƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚Ε‚ ‚ιBƒf[ƒ^‚̐ݒθ‚ͺI‚ν‚κ‚΁Aƒtƒ@ƒCƒ‹Šg’£Žq‚Ζ‚΅‚āu.csvv‚π‘I‚ρ‚Ε•Ϋ‘Ά‚·‚ι‚ƁACSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Δ•Ϋ‘Ά‚³‚κ‚ιB

}B.1‚Μ‚ζ‚€‚Ι“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ι‚ƁAŒvŽZ‚ͺŽn‚ά‚ιBStan‚Ι‚ζ‚ιƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚Έij‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}B.3jB

}B.3

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=1.055A90“CI‚ͺ[0.834, 1.262]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}B.3‚Μ‚Σ‚§‚ή‚π•Β‚Ά‚ι‚ƁAƒΡ‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}B.4jB

}B.4

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=0.403A90“CI‚ͺ[0.194, 0.614]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}B.4‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒJƒeƒSƒŠ‹«ŠE‚ΜŽ–Œγ•ͺ•z‚ͺŽ¦‚³‚κ‚ιi}B.5jB

}B.5

 

}B.5‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦^”δ—¦‚πŽ¦‚·ƒOƒ‰ƒt‚ͺά‚κόƒOƒ‰ƒt‚Ε•\Ž¦‚³‚κ‚ιi}B.6jB

}B.6

 

ƒf[ƒ^‚ͺ”jό‚Ε”δ—¦‚π•\‚΅Aƒ‚ƒfƒ‹‚ͺŽΐό‚ΕŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦‚Μ’†‰›’l‚Ε‚ ‚ιBuƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚Pv‚ŁAu‚ν‚©‚η‚Θ‚’v”»’f‚ͺuƒJƒeƒSƒŠ‚QvAuƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚Rv‚Ε•\‚³‚κ‚Δ‚’‚ιB

}B.6‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚ΜŽΐsI—Ή‚Ζ‚Θ‚ιBŽΐsI—ΉŒγAo—Νƒtƒ@ƒCƒ‹‚π“K“–‚ΘƒGƒfƒBƒ^‚ΕŠJ‚­‚ƁAˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

Input Data File = Data3Cat.csv

 

<N, S>

[20, 26, 54]

 

<S, N>

[77, 12, 11]

 

Inference for Stan model: anon_model_4f4c02dce251e874ae19399d5b4bfa08.

4 chains, each with iter=2000; warmup=1000; thin=1;

post-warmup draws per chain=1000, total post-warmup draws=4000.

 

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat

mu_s       1.05  2.0e-3   0.13    0.8   0.97   1.05   1.14    1.3   4000    1.0

tau         0.4  2.1e-3   0.13   0.15   0.32    0.4   0.49   0.65   3685    1.0

theta[0]   0.46  1.2e-3   0.07   0.33   0.41   0.46    0.5    0.6   3380    1.0

C[0]      -0.46  1.2e-3   0.07   -0.6   -0.5  -0.46  -0.41  -0.33   3380    1.0

C[1]       0.46  1.2e-3   0.07   0.33   0.41   0.46    0.5    0.6   3380    1.0

p_NS[0]    0.22  6.2e-4   0.04   0.15   0.19   0.22   0.24    0.3   4000    1.0

p_NS[1]    0.23  5.3e-4   0.03   0.17    0.2   0.23   0.25    0.3   4000    1.0

p_NS[2]    0.55  7.7e-4   0.05   0.46   0.52   0.55   0.59   0.65   4000    1.0

p_SN[0]    0.09  4.9e-4   0.02   0.05   0.07   0.09   0.11   0.15   2583    1.0

p_SN[1]    0.15  4.4e-4   0.03    0.1   0.13   0.15   0.17   0.21   4000    1.0

p_SN[2]    0.76  6.9e-4   0.04   0.67   0.73   0.76   0.79   0.83   3707    1.0

lp__     -181.4    0.03   1.25 -184.6 -181.9 -181.0 -180.4 -179.9   1942    1.0

 

Samples were drawn using NUTS at Wed Oct 23 11:33:50 2019.

For each parameter, n_eff is a crude measure of effective sample size,

and Rhat is the potential scale reduction factor on split chains (at

convergence, Rhat=1).

 

d':

Median = 1.055,   90%CI = [0.834, 1.262]

 

tau:

Median = 0.403,   90%CI = [0.194, 0.614]

 

C[1]:

Median = -0.455,   90%CI = [-0.575, -0.353]

 

C[2]:

Median = 0.455,   90%CI = [0.353, 0.575]

 

 

ŽŸ‚ɁA”»’fƒJƒeƒSƒŠ”‚ͺ‚TŒΒ‚̏ꍇiK=5j‚Μ—α‚πŽ¦‚·B

ƒf[ƒ^—α‚π}B.7‚ΙŽ¦‚·B

}B.7@ƒf[ƒ^ƒtƒ@ƒCƒ‹–ΌData5Cat.csv

 

ƒvƒƒOƒ‰ƒ€‚π‹N“‚΅‚āA}B.8‚Μ‚ζ‚€‚Ι“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ιB

}B.8

 

“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ι‚ΖŒvŽZ‚ͺŽn‚ά‚θAStan‚Ι‚ζ‚ιƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚Έdf‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}B.9jB

}B.9

 

}B.9‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒΡ‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}B.10jB

}B.10

 

}B.10‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒJƒeƒSƒŠ‹«ŠE‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}B.11jB

}B.11

 

}B.11‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA”»’fƒJƒeƒSƒŠ‚Μ”δ—¦‚ΖŠm—¦‚ͺ•\Ž¦‚³‚κ‚ιi}B.12jB

}B.12

 

ƒf[ƒ^‚ͺ”jό‚Ε”δ—¦‚π•\‚΅Aƒ‚ƒfƒ‹‚ͺŽΐό‚ΕŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦‚Μ’†‰›’l‚Ε‚ ‚ιB—Ⴆ‚΁AuƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚PvAu‚½‚Τ‚ρƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚QvAu‚ν‚©‚η‚Θ‚’v”»’f‚ͺuƒJƒeƒSƒŠ‚RvAu‚½‚Τ‚ρƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚SvAuƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚Tv‚Ε•\‚³‚κ‚Δ‚’‚ιB

}B.12‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚ΜŽΐsI—Ή‚Ζ‚Θ‚ιBŽΐsI—ΉŒγAo—Νƒtƒ@ƒCƒ‹‚πƒeƒLƒXƒgƒGƒfƒBƒ^‚ΕŠJ‚­‚ΖˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

 

Input Data File = Data5Cat.csv

 

<N, S>

[21, 10, 5, 18, 46]

 

<S, N>

[66, 10, 7, 12, 5]

 

Inference for Stan model: anon_model_4f4c02dce251e874ae19399d5b4bfa08.

4 chains, each with iter=2000; warmup=1000; thin=1;

post-warmup draws per chain=1000, total post-warmup draws=4000.

 

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat

mu_s       0.93  1.9e-3   0.12   0.68   0.85   0.93   1.01   1.17   4000    1.0

tau        0.38  1.9e-3   0.12   0.16    0.3   0.38   0.46   0.62   4000    1.0

theta[0]   0.14  5.9e-4   0.04   0.08   0.11   0.14   0.16   0.22   3924    1.0

theta[1]   0.58  1.1e-3   0.07   0.44   0.53   0.58   0.62   0.72   4000    1.0

C[0]      -0.72  1.2e-3   0.08  -0.87  -0.77  -0.72  -0.66  -0.57   4000    1.0

C[1]      -0.14  5.9e-4   0.04  -0.22  -0.16  -0.14  -0.11  -0.08   3924    1.0

C[2]       0.14  5.9e-4   0.04   0.08   0.11   0.14   0.16   0.22   3924    1.0

C[3]       0.72  1.2e-3   0.08   0.57   0.66   0.72   0.77   0.87   4000    1.0

p_NS[0]    0.19  5.6e-4   0.04   0.12   0.16   0.19   0.21   0.26   4000    1.0

p_NS[1]    0.13  2.6e-4   0.02    0.1   0.12   0.13   0.14   0.16   4000    1.0

p_NS[2]    0.07  3.1e-4   0.02   0.04   0.06   0.07   0.09   0.11   3901    1.0

p_NS[3]    0.16  3.2e-4   0.02   0.12   0.15   0.16   0.17    0.2   4000    1.0

p_NS[4]    0.45  7.6e-4   0.05   0.36   0.42   0.45   0.48   0.55   4000    1.0

p_SN[0]    0.08  3.4e-4   0.02   0.04   0.06   0.08   0.09   0.12   3837    1.0

p_SN[1]    0.08  2.0e-4   0.01   0.05   0.07   0.08   0.08    0.1   4000    1.0

p_SN[2]    0.05  2.4e-4   0.01   0.03   0.04   0.05   0.06   0.08   3703    1.0

p_SN[3]    0.13  3.0e-4   0.02    0.1   0.12   0.13   0.14   0.17   4000    1.0

p_SN[4]    0.66  7.2e-4   0.05   0.57   0.63   0.66   0.69   0.75   4000    1.0

lp__     -270.3    0.03   1.41 -273.8 -271.0 -270.0 -269.3 -268.5   2250    1.0

 

Samples were drawn using NUTS at Wed Oct 23 12:01:07 2019.

For each parameter, n_eff is a crude measure of effective sample size,

and Rhat is the potential scale reduction factor on split chains (at

convergence, Rhat=1).

 

d':

Median = 0.927,   90%CI = [0.727, 1.131]

 

tau:

Median = 0.383,   90%CI = [0.190, 0.579]

 

C[1]:

Median = -0.715,   90%CI = [-0.845, -0.592]

 

C[2]:

Median = -0.136,   90%CI = [-0.206, -0.086]

 

C[3]:

Median = 0.136,   90%CI = [0.086, 0.206]

 

C[4]:

Median = 0.715,   90%CI = [0.592, 0.845]

 

 

K‚ͺ‚SˆΘγ‚Μ‹τ”‚̏ꍇ

”»’f‚ΜƒJƒeƒSƒŠ”K‚ͺ‚SˆΘγ‚Μ‹τ”‚Ε‚ ‚ικ‡‚ΜStanƒXƒNƒŠƒvƒg‚πƒŠƒXƒgC.1‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgC.1@K‚ͺ‚SˆΘγ‚Μ‹τ”‚̏ꍇ‚ΜStanƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFCEvenCat.stanj

functions {

    real half_normal_lpdf(real y, real sgm){

        if (y > 0.0){

            return normal_lpdf(y | 0.0, sgm);

        } else {

            return log(0.0);

        }

    }

}

data {

    int K;

    int n_NS[K];

    int n_SN[K];

}

 

parameters {

    real mu_s;

    real tau;

    real<lower = 0.0> theta[K/2 - 1];

}

transformed parameters {

    real C[K - 1];

    simplex[K] p_NS;

    simplex[K] p_SN;

    C[K/2] = 0.0;

    for (k in 1: (K/2 -1)){

        C[K/2 + k] = C[K/2 + k - 1] + theta[k];

        C[K/2 - k] = -C[K/2 + k];

    }

    p_NS[1] = Phi((C[1] - (mu_s - tau))/sqrt(2.0));

    p_NS[K] = 1 - Phi((C[K - 1] - (mu_s - tau))/sqrt(2.0));

 

    for (k in 2:(K-1)) {

        p_NS[k] = Phi((C[k] - (mu_s - tau))/sqrt(2.0)) -

                   Phi((C[k - 1] - (mu_s - tau))/sqrt(2.0));

    }

 

    p_SN[1] = Phi((C[1] - (mu_s + tau))/sqrt(2.0));

    p_SN[K] = 1 - Phi((C[K - 1] - (mu_s + tau))/sqrt(2.0));

   

    for (k in 2:(K-1)) {

        p_SN[k] = Phi((C[k] - (mu_s + tau))/sqrt(2.0)) -

                   Phi((C[k - 1] - (mu_s + tau))/sqrt(2.0));

    }

}

model {

    for (k in 1:(K/2 - 1)) {

        theta[k] ~ half_normal(1000.0);

    }

    mu_s ~ normal(0.0, 100.0);

    tau ~ normal(0.0, 100.0);

    n_NS ~ multinomial(p_NS);

    n_SN ~ multinomial(p_SN);

}

 

ƒŠƒXƒgC.1‚ΜStanƒXƒNƒŠƒvƒgSDT2AFCEvenCat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒg‚πAƒŠƒXƒgC.2‚Μ‚ζ‚€‚Ι—pˆΣ‚΅‚½B

 

ƒŠƒXƒgC.2@StanƒXƒNƒŠƒvƒgSDT2AFCEvenCat.stan‚π—˜—p‚·‚ιPythonƒXƒNƒŠƒvƒgiƒtƒ@ƒCƒ‹–ΌSDT2AFCEvenCat.pyj

import numpy as np

import pystan

import matplotlib.pyplot as plt

import csv

import pickle

 

flnm = input('“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό(*.csv) = ')

with open(flnm, 'r') as f:

    data = [v for v in csv.reader(f)]

 

fout_nm = input('o—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό = ')

fout = open(fout_nm, 'w')

fout.write('Input Data File = {}\n'.format(flnm))

 

K = len(data[0]) - 1

print('K = ', K)

if (K % 2) == 1:

    print('•]’θƒJƒeƒSƒŠ”‚Ν‹τ”‚Ε‚Θ‚―‚κ‚Ξ‚Θ‚η‚Θ‚’!')

    import sys

    sys.exit()

   

Freq_NS = []

for k in range(K):

    Freq_NS.append(int(data[1][1 + k]))

Freq_SN = []

for k in range(K):

    Freq_SN.append(int(data[2][1 + k]))

print(Freq_NS)

print(Freq_SN)

fout.write('\n<N, S>\n{}\n'.format(Freq_NS))

fout.write('\n<S, N>\n{}\n'.format(Freq_SN))  

TN_NS = sum(Freq_NS)

Rating_NS = Freq_NS

print(Rating_NS)

TN_SN = sum(Freq_SN)

Rating_SN = []

for k in range(K):

    Rating_SN.append(Freq_SN[K - 1 - k])

 

Data = {'K': K, 'n_NS': Rating_NS, 'n_SN': Rating_SN}

 

sm = pystan.StanModel(file = 'SDT2AFCEvenCat.stan')

 

fit = sm.sampling(data = Data, n_jobs = 1)

 

print(fit)

fout.write('\n{}\n'.format(fit))

 

mu = fit['mu_s']

tau = fit['tau']

C = fit['C']

p_NS = fit['p_NS']

p_SN = fit['p_SN']

 

mu_L05 = np.percentile(mu, 5)

mu_med = np.percentile(mu, 50)

mu_U95 = np.percentile(mu, 95)

fout.write("\nd':\nMedian = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]\n".

           format(mu_med, mu_L05, mu_U95))

 

tau_L05 = np.percentile(tau, 5)

tau_med = np.percentile(tau, 50)

tau_U95 = np.percentile(tau, 95)

fout.write('\ntau:\nMedian = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]\n'.

           format(tau_med, tau_L05, tau_U95))

 

C_L05 = np.zeros(K-1)

C_med = np.zeros(K-1)

C_U95 = np.zeros(K-1)

for k in range(K-1):

    C_L05[k] = np.percentile(C.T[k], 5)

    C_med[k] = np.percentile(C.T[k], 50)

    C_U95[k] = np.percentile(C.T[k], 95)

for k in range(K-1):

    fout.write(('\nC[{0}]:\n' + \

               'Median = {1:<.3f},   90%CI = [{2:<.3f}, {3:<.3f}]\n').

               format(k+1, C_med[k], C_L05[k], C_U95[k]))

 

plt.hist(mu)

plt.xlabel("d'($\mu_S$)", fontsize = 14)

plt.title("Posterior Distribution of d'($\mu_S$)" + \

          '\nMed. = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]'.

          format(mu_med, mu_L05, mu_U95), fontsize = 16)

plt.show()

 

plt.hist(tau)

plt.xlabel(r'$\tau$', fontsize = 18)

plt.title(r'Posterior Distribution of $\tau$' + \

          '\nMed. = {0:<.3f},   90%CI = [{1:<.3f}, {2:<.3f}]'.

          format(tau_med, tau_L05, tau_U95), fontsize = 16)

plt.show()

 

for k in range(K-1):

    if k + 1 != K/2:

        plt.hist(C.T[k], label = 'C{}'.format(k+1))

plt.title('Posterior Distributions of Category Boundaries' + \

          '\nC{} = 0 fixed'.format(K//2), fontsize = 16)

plt.legend(loc = 'lower center')

plt.show()

 

xcat = np.arange(1, K+0.1, 1)

xlabels = ['{}'.format(int(v)) for v in xcat]

y1 = []

y2 = []

for k in range(K):

    y1.append(Freq_NS[k]/TN_NS)

    y2.append(Freq_SN[k]/TN_SN)

 

p1 = np.median(p_NS, axis = 0)

p2 = np.median(p_SN, axis = 0)

p2 = np.flip(p2)

 

plt.plot(xcat, y1, 'b--', linewidth = 3, alpha = 0.7, label = 'Data/<N, S>')

plt.plot(xcat, p1, 'g-', linewidth = 3, alpha = 0.7, label = 'Model/<N, S>')

plt.plot(xcat, y2, 'r--', linewidth = 3, alpha = 0.7, label = 'Data/<S, N>')

plt.plot(xcat, p2, 'm-', linewidth = 3, alpha = 0.7, label = 'Model/<S, N>')

 

plt.xticks(xcat, xlabels, fontsize = 14)

plt.xlabel('Rating Category', fontsize = 14)

plt.ylabel('Probability/Proportion', fontsize = 14)

plt.title('Ratings in Conditions <N, S> and <S, N>', fontsize = 18)

plt.legend(loc = 'upper center', fontsize = 10)

plt.show()

 

fout.close()

print('\n{} was saved.\n'.format(fout_nm))

 

ƒŠƒXƒgC.1‚ΖƒŠƒXƒgC.2‚Μƒtƒ@ƒCƒ‹‚¨‚ζ‚ΡƒTƒ“ƒvƒ‹ƒf[ƒ^ƒtƒ@ƒCƒ‹‚́A‚ά‚Ζ‚ί‚Δˆ³kƒtƒ@ƒCƒ‹RatingEvenCat.zip‚Ζ‚΅‚½Bƒ_ƒEƒ“ƒ[ƒh‰π“€‚·‚κ‚΁AŽ©—R‚Ι—˜—p‚Ε‚«‚ιB

ƒŠƒXƒgC.2‚Μƒtƒ@ƒCƒ‹SDT2AFCEvenCat.py‚πŽΐs‚·‚ι‚ƁA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚̐ݒθ‚ͺ‹‚ί‚η‚κ‚ιi}C.1jB

}C.1

 

o—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚Ν”CˆΣ‚ΜƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Όiƒtƒ@ƒCƒ‹Šg’£Žq.txtj‚Ε‚ ‚ι‚ͺA“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹‚ΝCSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Đ}C.2‚Μ—lŽ‚Ε—pˆΣ‚·‚ιB

}C.2@ƒf[ƒ^ƒtƒ@ƒCƒ‹Data4Cat.csv

 

‘ζ‚Ps–ڂ͕ϐ”–Ό‚Μ–Ό‘O‚πέ’θ‚·‚ι‚ͺAƒvƒƒOƒ‰ƒ€‚Ε‚Ν—p‚’‚Θ‚’‚Μ‚Ε”CˆΣ‚Μ•ΆŽš—ρ‚Ε‚ζ‚’B‚½‚Ύ‚΅A‘ζ‚Ps–Ϊ‘ζ‚P—ρ–Ϊ‚Ι•ΆŽš—ρID‚πέ’θ‚·‚ι‚ƁAExcel‚̏ꍇA“ǂݍž‚έŽž‚ΙƒGƒ‰[ƒƒbƒZ[ƒW‚ͺ•\Ž¦‚³‚κ‚ι‚±‚Ζ‚ͺ‚ ‚ι‚ͺA‚±‚κ‚Ν–³Ž‹‚·‚ιB‘ζ‚Qs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒNAS>i—Ⴆ‚΁AΆ‚ΙƒmƒCƒYŽhŒƒA‰E‚ΙƒVƒOƒiƒ‹ŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂɁu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιi‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚S—ρ–ڂɁu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιi‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚T—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Rs–Ϊ‚ΙŽhŒƒ’ρŽ¦πŒƒSAN„i—Ⴆ‚΁AΆ‚ΙƒVƒOƒiƒ‹ŽhŒƒA‰E‚ΙƒmƒCƒYŽhŒƒj‚Ι‚¨‚―‚ιƒf[ƒ^‚πέ’θ‚·‚ιB‘ζ‚Q—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ3—ρ–ڂɁu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚S—ρ–ڂɁu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιi‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚T—ρ–ڂɁuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚πέ’θ‚·‚ιB‘ζ‚Qs–ځA‘ζ‚Rs–Ϊ‚Ζ‚ΰA‘ζ‚Q—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιi—Ⴆ‚΁AƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚R—ρ–ڂ́u‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιi‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚͍Ά‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚S—ρ–ڂ́u‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιi‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”A‘ζ‚T—ρ–ڂ́uƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιiƒVƒOƒiƒ‹ŽhŒƒ‚Ν‰E‚Ε‚ ‚ιjv‚Ζ”»’f‚³‚κ‚½“x”‚Ε‚ ‚ιBƒf[ƒ^‚̐ݒθ‚ͺI‚ν‚κ‚΁Aƒtƒ@ƒCƒ‹Šg’£Žq‚Ζ‚΅‚āu.csvv‚π‘I‚ρ‚Ε•Ϋ‘Ά‚·‚ι‚ƁACSVŒ`Ž‚Μƒtƒ@ƒCƒ‹‚Ζ‚΅‚Δ•Ϋ‘Ά‚³‚κ‚ιB

}C.1‚Μ‚ζ‚€‚Ι“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—ΝƒeƒLƒXƒgƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ι‚ƁAŒvŽZ‚ͺŽn‚ά‚ιBStan‚Ι‚ζ‚ιƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚Έij‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}C.3jB

}C.3

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=1.052A90“CI‚ͺ[0.849, 1.264]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}C.3‚Μ‚Σ‚§‚ή‚π•Β‚Ά‚ι‚ƁAƒΡ‚ΜŽ–Œγ•ͺ•z‚ΜƒqƒXƒgƒOƒ‰ƒ€‚ͺ•\Ž¦‚³‚κ‚ιi}C.4jB

}C.4

 

Ž–Œγ•ͺ•z‚Μ’†‰›’l‚ͺMed.=0.433A90“CI‚ͺ[0.227, 0.631]‚Ε‚ ‚ι‚±‚Ζ‚ͺŽ¦‚³‚κ‚Δ‚’‚ιB

}C.4‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒJƒeƒSƒŠ‹«ŠE‚ΜŽ–Œγ•ͺ•z‚ͺŽ¦‚³‚κ‚ιi}C.5jB

}C.5

 

ƒJƒeƒSƒŠ‹«ŠEC2=0‚͐§–ρπŒ‚Ζ‚΅‚ΔŒΕ’θ‚³‚κ‚Δ‚’‚ι‚̂ŁAC2‚ΜƒqƒXƒgƒOƒ‰ƒ€‚Ν•\Ž¦‚³‚κ‚Δ‚’‚Θ‚’A

}C.5‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦^”δ—¦‚πŽ¦‚·ƒOƒ‰ƒt‚ͺά‚κόƒOƒ‰ƒt‚Ε•\Ž¦‚³‚κ‚ιi}C.6jB

}C.6

 

ƒf[ƒ^‚ͺ”jό‚Ε”δ—¦‚π•\‚΅Aƒ‚ƒfƒ‹‚ͺŽΐό‚ΕŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦‚Μ’†‰›’l‚Ε‚ ‚ιBuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚PvAu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚QvAu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚RvAuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚Sv‚Ε•\‚³‚κ‚Δ‚’‚ιB

}C.6‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚ΜŽΐsI—Ή‚Ζ‚Θ‚ιBŽΐsI—ΉŒγAo—Νƒtƒ@ƒCƒ‹‚π“K“–‚ΘƒGƒfƒBƒ^‚ΕŠJ‚­‚ƁAˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

Input Data File = Data4Cat.csv

 

<N, S>

[24, 9, 12, 55]

 

<S, N>

[74, 13, 7, 6]

 

Inference for Stan model: anon_model_f2c4de04275e32f42265169574310b77.

4 chains, each with iter=2000; warmup=1000; thin=1;

post-warmup draws per chain=1000, total post-warmup draws=4000.

 

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat

mu_s       1.05  2.0e-3   0.12   0.81   0.97   1.05   1.14    1.3   4000    1.0

tau        0.43  2.0e-3   0.12   0.19   0.35   0.43   0.52   0.68   4000    1.0

theta[0]   0.51  1.1e-3   0.07   0.38   0.46    0.5   0.55   0.65   4000    1.0

C[0]      -0.51  1.1e-3   0.07  -0.65  -0.55   -0.5  -0.46  -0.38   4000    1.0

C[1]        0.0     0.0    0.0    0.0    0.0    0.0    0.0    0.0   4000    nan

C[2]       0.51  1.1e-3   0.07   0.38   0.46    0.5   0.55   0.65   4000    1.0

p_NS[0]    0.22  6.0e-4   0.04   0.15   0.19   0.21   0.24   0.29   4000    1.0

p_NS[1]    0.12  2.5e-4   0.02   0.09   0.11   0.12   0.13   0.15   4000    1.0

p_NS[2]    0.14  3.1e-4   0.02    0.1   0.12   0.14   0.15   0.18   4000    1.0

p_NS[3]    0.53  7.6e-4   0.05   0.44    0.5   0.53   0.56   0.63   4000    1.0

p_SN[0]    0.08  3.8e-4   0.02   0.04   0.07   0.08    0.1   0.13   3404    1.0

p_SN[1]    0.07  1.9e-4   0.01   0.05   0.06   0.07   0.07   0.09   4000    1.0

p_SN[2]     0.1  2.7e-4   0.02   0.07   0.09    0.1   0.11   0.13   4000    1.0

p_SN[3]    0.75  6.5e-4   0.04   0.67   0.73   0.76   0.78   0.83   4000    1.0

lp__     -209.9    0.03   1.22 -213.0 -210.4 -209.6 -209.1 -208.5   1661    1.0

 

Samples were drawn using NUTS at Wed Oct 23 15:01:23 2019.

For each parameter, n_eff is a crude measure of effective sample size,

and Rhat is the potential scale reduction factor on split chains (at

convergence, Rhat=1).

 

d':

Median = 1.052,   90%CI = [0.849, 1.264]

 

tau:

Median = 0.433,   90%CI = [0.227, 0.631]

 

C[1]:

Median = -0.503,   90%CI = [-0.623, -0.396]

 

C[2]:

Median = 0.000,   90%CI = [0.000, 0.000]

 

C[3]:

Median = 0.503,   90%CI = [0.396, 0.623]

 

 

ŽŸ‚ɁA”»’fƒJƒeƒSƒŠ”‚ͺ‚UŒΒ‚̏ꍇiK=‚Uj‚Μ—α‚πŽ¦‚·B

ƒf[ƒ^—α‚π}C.7‚ΙŽ¦‚·B

}C.7@ƒf[ƒ^ƒtƒ@ƒCƒ‹–ΌData6Cat.csv

 

ƒvƒƒOƒ‰ƒ€‚π‹N“‚΅‚āA}C.8‚Μ‚ζ‚€‚Ι“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ιB

}C.8

 

“ό—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚Əo—Νƒf[ƒ^ƒtƒ@ƒCƒ‹–Ό‚πέ’θ‚·‚ι‚ΖŒvŽZ‚ͺŽn‚ά‚θAStan‚Ι‚ζ‚ιƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚Έdf‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}C.9jB

}C.9

 

}C.9‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒΡ‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}C.10jB

}C.10

 

}C.10‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒJƒeƒSƒŠ‹«ŠE‚ΜŽ–Œγ•ͺ•z‚ͺ•\Ž¦‚³‚κ‚ιi}C.11jB

}C.11

 

}C.11‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA”»’fƒJƒeƒSƒŠ‚Μ”δ—¦‚ΖŠm—¦‚ͺ•\Ž¦‚³‚κ‚ιi}C.12jB

}C.12

 

ƒf[ƒ^‚ͺ”jό‚Ε”δ—¦‚π•\‚΅Aƒ‚ƒfƒ‹‚ͺŽΐό‚ΕŠe”»’fƒJƒeƒSƒŠ‚ΜŠm—¦‚Μ’†‰›’l‚Ε‚ ‚ιB—Ⴆ‚΁AuŠm‚©‚ΙƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚PvAuƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚QvAu‘½•ͺƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚RvAu‘½•ͺƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚SvAuƒVƒOƒiƒ‹‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚TvAuŠm‚©‚ΙƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιv”»’f‚ͺuƒJƒeƒSƒŠ‚Uv‚Ε•\‚³‚κ‚Δ‚’‚ιB

}C.12‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚ΜŽΐsI—Ή‚Ζ‚Θ‚ιBŽΐsI—ΉŒγAo—Νƒtƒ@ƒCƒ‹‚πƒeƒLƒXƒgƒGƒfƒBƒ^‚ΕŠJ‚­‚ΖˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

Input Data File = Data6Cat.csv

 

<N, S>

[6, 23, 5, 4, 37, 25]

 

<S, N>

[42, 38, 2, 5, 11, 2]

 

Inference for Stan model: anon_model_f2c4de04275e32f42265169574310b77.

4 chains, each with iter=2000; warmup=1000; thin=1;

post-warmup draws per chain=1000, total post-warmup draws=4000.

 

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat

mu_s       0.98  1.9e-3   0.12   0.75    0.9   0.98   1.06   1.21   3659    1.0

tau        0.36  1.8e-3   0.11   0.14   0.29   0.36   0.44   0.58   3867    1.0

theta[0]   0.19  7.1e-4   0.04   0.11   0.16   0.19   0.22   0.29   4000    1.0

theta[1]   1.42  1.9e-3   0.11    1.2   1.34   1.41   1.49   1.64   3720    1.0

C[0]      -1.61  2.0e-3   0.12  -1.83  -1.68   -1.6  -1.53  -1.39   3409    1.0

C[1]      -0.19  7.1e-4   0.04  -0.29  -0.22  -0.19  -0.16  -0.11   4000    1.0

C[2]        0.0     0.0    0.0    0.0    0.0    0.0    0.0    0.0   4000    nan

C[3]       0.19  7.1e-4   0.04   0.11   0.16   0.19   0.22   0.29   4000    1.0

C[4]       1.61  2.0e-3   0.12   1.39   1.53    1.6   1.68   1.83   3409    1.0

p_NS[0]    0.06  2.9e-4   0.02   0.03   0.05   0.06   0.07    0.1   3717    1.0

p_NS[1]    0.22  4.2e-4   0.03   0.17   0.21   0.22   0.24   0.28   4000    1.0

p_NS[2]    0.05  1.7e-4   0.01   0.03   0.04   0.05   0.05   0.07   4000    1.0

p_NS[3]    0.05  1.9e-4   0.01   0.03   0.04   0.05   0.06   0.08   4000    1.0

p_NS[4]    0.37  4.7e-4   0.03   0.32   0.36   0.37   0.39   0.43   3591    1.0

p_NS[5]    0.24  6.1e-4   0.04   0.17   0.22   0.24   0.27   0.33   4000    1.0

p_SN[0]    0.02  1.5e-4 8.1e-3 7.8e-3   0.01   0.02   0.02   0.04   2755    1.0

p_SN[1]    0.12  3.6e-4   0.02   0.08   0.11   0.12   0.14   0.16   3664    1.0

p_SN[2]    0.03  1.2e-4 7.5e-3   0.02   0.03   0.03   0.04   0.05   4000    1.0

p_SN[3]    0.04  1.5e-4 9.3e-3   0.02   0.03   0.04   0.04   0.06   4000    1.0

p_SN[4]    0.36  4.7e-4   0.03   0.31   0.34   0.36   0.38   0.42   4000    1.0

p_SN[5]    0.43  7.3e-4   0.05   0.34    0.4   0.43   0.46   0.52   4000    1.0

lp__     -298.2    0.03   1.48 -301.9 -298.8 -297.8 -297.1 -296.3   1982    1.0

 

Samples were drawn using NUTS at Wed Oct 23 15:26:01 2019.

For each parameter, n_eff is a crude measure of effective sample size,

and Rhat is the potential scale reduction factor on split chains (at

convergence, Rhat=1).

 

d':

Median = 0.981,   90%CI = [0.789, 1.178]

 

tau:

Median = 0.363,   90%CI = [0.177, 0.547]

 

C[1]:

Median = -1.605,   90%CI = [-1.799, -1.424]

 

C[2]:

Median = -0.187,   90%CI = [-0.271, -0.124]

 

C[3]:

Median = 0.000,   90%CI = [0.000, 0.000]

 

C[4]:

Median = 0.187,   90%CI = [0.124, 0.271]

 

C[5]:

Median = 1.605,   90%CI = [1.424, 1.799]

 

 

‚QŽˆ‹­§‘I‘π•]’θ–@‚ΜŠg’£”Ε

 

‚QAFC‰Ϋ‘θ‚ł́AƒVƒOƒiƒ‹ŽhŒƒŠ΄Šo‚Μ•½‹Ο’l‚Ζ•ͺŽU‚πŒΒ•Κ‚ɐ„’θ‚·‚ι‚±‚Ζ‚Ν‚Ε‚«‚Θ‚’B‚±‚Μ‚±‚Ζ‚πƒOƒ‰ƒt‚ΕŒ©‚Δ‚έ‚ιB

‚’‚܁AƒmƒCƒYŽhŒƒŠ΄Šo‚ΖƒVƒOƒiƒ‹ŽhŒƒŠ΄Šo‚ͺŽŸ‚̐³‹K•ͺ•z‚ɏ]‚€‚Ζ‚·‚ιB

‚±‚Μ‚Ζ‚«

‚Ζ‚Θ‚ι‚̂ŁA³“šŠm—¦‚Ν

‚Ε—^‚¦‚η‚κ‚ιB

³“šŠm—¦‚Μ‚ΜƒOƒ‰ƒt‚́A}Ex.1‚Μ‚ζ‚€‚Ε‚ ‚ιB

}Ex.1

 

}Ex.1‚ΜƒOƒ‰ƒt‚ΝƒŠƒXƒgEx.1‚ΜƒXƒNƒŠƒvƒg‚Ε•`‚’‚Δ‚’‚ιBƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹‚́Aˆ³kƒtƒ@ƒCƒ‹Ex2AFCR.zip‚Ι“Z‚ί‚½‚̂ŁAƒ_ƒEƒ“ƒ[ƒh“WŠJ‚΅‚ΔŽ©—R‚Ι—˜—p‚³‚κ‚½‚’B

ƒVƒOƒiƒ‹Š΄Šo‚Μ•½‹Ο’l‚ͺ‘ε‚«‚­‚Θ‚ι‚ƁA³“šŠm—¦‚ΰγ‚ͺ‚ι‚ͺA•W€•Ξ·‚ͺ‘ε‚«‚­‚Θ‚ι‚Ɛ³“šŠm—¦‚Ν‰Ί‚ͺ‚ιB

“―‚Ά“™‚όγ‚Μ‚Ζ‚Μ’l‚Μ‘g‚Ν“―‚Ά³“šŠm—¦Pc‚π—^‚¦‚ι‚̂ŁA³“šŠm—¦Pc‚©‚η‚Ζ‚Μ’l‚Μ‘g‚πŒˆ‚ί‚ι‚±‚Ζ‚Ν‚Ε‚«‚Θ‚’B‚Ζ‚Μ’l‚Μ‘g‚́A‚QAFC‰Ϋ‘θ‚πˆΘ‰Ί‚Μ‚ζ‚€‚ΙŠg’£‚·‚ι‚Ζ‹‚ί‚ι‚±‚Ζ‚ͺ‚Ε‚«‚ιB

‚QAFC‚ł́A’ρŽ¦ŽhŒƒ‘΂́ƒƒmƒCƒYAƒVƒOƒiƒ‹„‚ƁƒƒVƒOƒiƒ‹AƒmƒCƒY„‚Μ2Žν—ή‚Ε‚ ‚ιB‚±‚κ‚ɁAƒƒmƒCƒYAƒmƒCƒY„‚ƁƒƒVƒOƒiƒ‹AƒVƒOƒiƒ‹„‚Μ‚QŽν—ή‚π‰Α‚¦‚āA‚SŽν—ή‚ΜŽhŒƒ‘Ξ‚Ι‘Ξ‚΅‚Δ•]’θ–@‚π—p‚’‚ι‚ƁAƒVƒOƒiƒ‹ŽhŒƒŠ΄Šo‚Μ•½‹Ο’l‚Ζ•ͺŽU‚̐„’θ‚πs‚€‚±‚Ζ‚ͺ‚Ε‚«‚ιB

‚QAFC‰Ϋ‘θ‚ł́AŠeŽŽs‚Ι‚¨‚’‚Δ‚Q‚Β‚ΜŽhŒƒiŽhŒƒ‘΁j‚ͺ—^‚¦‚η‚κ‚ιBŠeŽhŒƒ‚Μ’ρŽ¦ˆΚ’ui‹σŠΤ“IAŽžŠΤ“Ij‚πƒS1, S2„‚Ε•\‚·B‘ζ1’ρŽ¦ˆΚ’u‚ͺS1A‘ζ‚Q’ρŽ¦ˆΚ’u‚ͺS2‚Ε‚ ‚ιBƒn, s„i‚ ‚ι‚’‚́An-sj‚́A‘ζ‚PˆΚ’u‚ΙƒmƒCƒYŽhŒƒA‘ζ‚QˆΚ’u‚ΙƒVƒOƒiƒ‹ŽhŒƒ‚ͺ’ρŽ¦‚³‚κ‚½‚±‚Ζ‚π•\‚·B

‘ζ‚P’ρŽ¦ˆΚ’u‚ΜŽhŒƒŠ΄Šo‚πA‘ζ‚QŽhŒƒ’ρŽ¦ˆΚ’u‚ΜŽhŒƒŠ΄Šo‚π‚Ε•\‚·B

‘ζ‚PŽhŒƒˆΚ’u‚Ι‘Ξ‚·‚ι‘ζ‚QŽhŒƒˆΚ’u‚ΜƒoƒCƒAƒX‚πb‚Ε•\‚·B‚±‚ΜƒoƒCƒAƒX‚͍PνŒλ·‚Μ‚ζ‚€‚ΙŠ΄Šo‚Μ‚ΰ‚Μ‚Ζ”½‰ž‚Μ‚ΰ‚Μ‚Μ—ΌŽ‚πŠά‚ή‚ΰ‚Μ‚Ε‚ ‚ιB

‚±‚Μ‚Ζ‚«AˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚ιB

‚Μ‚Ζ‚«A

‚Μ‚Ζ‚«A

‚Μ‚Ζ‚«A

‚Μ‚Ζ‚«A

 

‚’‚܁A”»’f‚ͺKŒΒ‚ΜƒJƒeƒSƒŠ‚Ι‚ζ‚ι•]’θ‚Ε‰ρ“š‚³‚κ‚ι‚ΰ‚Μ‚Ζ‚΅A”»’f‚ΜƒJƒeƒSƒŠ‹«ŠE‚πˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚¨‚­B

‚±‚Μ‚Ζ‚«A

‚Ε‚ ‚κ‚΁A’ρŽ¦ŽhŒƒ‘Ξ<>‚Ι‘Ξ‚·‚ι”»’f‚Ν‚ͺ—^‚¦‚η‚κ‚ι‚Ζ‚·‚ιB‚·‚Θ‚ν‚ΏA

‚Ε‚ ‚ιB

—Ⴆ‚΁A”»’fƒJƒeƒSƒŠ[”‚ͺŒΒ‚Μ‚Ζ‚«‚́A•]’θ”»’f‚ΝˆΘ‰Ί‚Μ‚ζ‚€‚Θ‚ΰ‚Μ‚ͺl‚¦‚η‚κ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚ΝŠm‚©‚Ι‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚PˆΚ’u‚Ε‚ ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚Ν‚½‚Τ‚ρ‘ζ‚PŽhŒƒ‚Ε‚ ‚ιB

F@‚ν‚©‚η‚Θ‚’^‚Η‚Ώ‚η‚ΰ“―‚Ά‚ΖŽv‚ν‚κ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚Ν‚½‚Τ‚ρ‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚Ν‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

F@ƒVƒOƒiƒ‹ŽhŒƒ‚ΝŠm‚©‚Ι‘ζ‚QˆΚ’u‚Ε‚ ‚ιB

 

•½‹ΟA•ͺŽU‚̐³‹K•ͺ•z‚̗ݐϕͺ•z‚π

‚Ε•\‚΅AˆΘ‰Ί‚Μ‚ζ‚€‚Ι•Φ‹X“I‚ɐݒ肷‚ιB

‚±‚Μ‚Ζ‚«A·‚Μ•ͺ•z‚ΝˆΘ‰Ί‚Μ‚ζ‚€‚Ι—^‚¦‚η‚κ‚ιB

ŽhŒƒ‘Ξ ‚ͺ’ρŽ¦‚³‚κ‚Ζ‚«A

‚΅‚½‚ͺ‚Α‚āA

ŽhŒƒ‘Ξ‚ͺ’ρŽ¦‚³‚κ‚½‚Ζ‚«A

‚΅‚½‚ͺ‚Α‚āA

ŽhŒƒ‘Ξ‚ͺ’ρŽ¦‚³‚κ‚½‚Ζ‚«A

‚΅‚½‚ͺ‚Α‚āA

ŽhŒƒ‘Ξ‚ͺ’ρŽ¦‚³‚κ‚½‚Ζ‚«A

‚΅‚½‚ͺ‚Α‚āA

 

‚’‚܁AƒJƒeƒSƒŠ‹«ŠE‚́AŒ΄“_‚𒆐S‚Ζ‚΅‚đΏ̂ɐݒ肳‚κ‚Δ‚’‚ι‚Ζ‚·‚ιB

‚΅‚½‚ͺ‚Α‚āAK‚ͺ‹τ”‚Ε‚ ‚κ‚΁A

Šο”‚Ε‚ ‚κ‚΁A

 

γ‚Μƒ‚ƒfƒ‹‚ΙŠξ‚Γ‚’‚ΔƒxƒCƒY•ͺΝ‚·‚ι‚½‚ί‚ΜStanƒXƒNƒŠƒvƒg‚πAK‚ͺ‹τ”‚̏ꍇ‚πƒŠƒXƒgEx.‚Q‚ɁAK‚ͺŠο”‚̏ꍇ‚πƒŠƒXƒgEx.3‚ΙŽ¦‚·B‚±‚κ‚η‚ΜƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹‚π—p‚’‚ΔŠg’£‚QAFC•]’θ–@‚Ι‚ζ‚ιƒf[ƒ^‚πƒxƒCƒY•ͺΝ‚·‚ιƒXƒNƒŠƒvƒg‚πƒŠƒXƒgEx.4‚ΙŽ¦‚·B‚±‚κ‚η‚Μƒtƒ@ƒCƒ‹‚Νˆ³kƒtƒ@ƒCƒ‹Ex2AFCR.zip‚Ι‚ά‚Ζ‚ί‚½Bƒ_ƒEƒ“ƒ[ƒh“WŠJ‚΅‚ΔŽ©—R‚Ι—˜—p‚³‚κ‚½‚’B

‚Θ‚¨APyStan 3—p‚ΜƒXƒNƒŠƒvƒg‚π‚±‚ΜƒEƒFƒuƒTƒCƒg‚Ι—pˆΣ‚΅‚Δ‚’‚ιB

 

ƒŠƒXƒgEx.4‚ΜŽΐs—α‚πˆΘ‰Ί‚ΙŽ¦‚·BƒXƒNƒŠƒvƒg‚ΜŽΐs‚́AWindows‚ΙƒCƒ“ƒXƒg[ƒ‹‚³‚κ‚½Anaconda‚ΜPython3.7‰Ό‘zŠΒ‹«‚Ι‚¨‚’‚ΔPyStan2.17.1.0‚π—p‚’‚čs‚Α‚½B

StanƒXƒNƒŠƒvƒg‚ΜŽΐsŽž‚ɁAƒRƒ“ƒpƒCƒ‹‚ΙŠΦ‚ν‚ιƒGƒ‰[‚ͺo‚½‚Ζ‚«‚́AC++ƒRƒ“ƒpƒCƒ‰‚πƒCƒ“ƒXƒg[ƒ‹‚΅‚Δ‚έ‚ι‚Ζ‚ζ‚’BŽg—pPC‚ł́AVisual Studio‚ΜC++‚ͺƒCƒ“ƒXƒg[ƒ‹‚³‚κ‚Δ‚’‚ιB

Ubuntu‚̏ꍇ‚ΰAStanƒXƒNƒŠƒvƒg‚ΜŽΐsŽž‚ΙƒRƒ“ƒpƒCƒ‹‚ΙŠΦ‚ν‚ιƒGƒ‰[‚ͺ•\Ž¦‚³‚κ‚½‚Ζ‚«‚́AC++ƒRƒ“ƒpƒCƒ‰‚πƒCƒ“ƒXƒg[ƒ‹‚΅‚Δ‚έ‚ι‚Ζ‚ζ‚’BC++‚πŠά‚ί‚½•‘”‚ΜŒΎŒκ‚Ι‘Ξ‰ž‚·‚ι‚ΰ‚Μ‚Ζ‚΅‚Δg++‚ͺ‚ ‚ιBUbuntu‚̏ꍇAƒRƒ}ƒ“ƒhug++v‚πŽΐs‚·‚ι‚ƁAug++‚ΝŒ©‚Β‚©‚θ‚ά‚Ή‚ρBŽŸ‚ΜƒRƒ}ƒ“ƒh‚ΕƒCƒ“ƒXƒg[ƒ‹‚΅‚Δ‰Ί‚³‚’Bv‚Ζ‚’‚€‚ζ‚€‚ΘƒƒbƒZ[ƒW‚ͺ•\Ž¦‚³‚κ‚½‚ηAŽwŽ¦’Κ‚θAƒRƒ}ƒ“ƒh‚π“ό—ΝŽΐs‚·‚ι‚ΖƒCƒ“ƒXƒg[ƒ‹‚³‚κ‚ιBg++‚ΜƒCƒ“ƒXƒg[ƒ‹Œγ‚́AStanƒXƒNƒŠƒvƒg‚ΝƒRƒ“ƒpƒCƒ‹Žΐs‚³‚κ‚ι‚Ν‚Έ‚Ε‚ ‚ιB

 

‚ά‚ΈAƒJƒeƒSƒŠ”‚ͺ‚UŒΒ‚Μ‹τ”‚̏ꍇ‚Ι‚Β‚’‚ΔŽ¦‚΅A‘±‚’‚ΔƒJƒeƒSƒŠ”‚ͺ‚VŒΒ‚ΜŠο”‚̏ꍇ‚πŽ¦‚·B

 

 

ƒJƒeƒSƒŠ”‚ͺK=6ŒΒ‚̏ꍇ

 

•\Ex.1‚Μ‚ζ‚€‚Θƒf[ƒ^‚ͺ—^‚¦‚η‚κ‚½‚Ζ‚·‚ιB

 

•\Ex.1@ƒJƒeƒSƒŠ”‚ͺ‚UŒΒ‚̏ꍇ

”»’fƒJƒeƒSƒŠR

n-n

n-s

s-n

s-s

1

2

1

6

6

2

5

1

10

3

3

15

13

24

12

4

21

21

7

21

5

6

7

3

6

6

1

7

0

2

 

 

ƒŠƒXƒgEx.4‚Μƒtƒ@ƒCƒ‹AnalEx2AFCR.py‚πŽΐs‚·‚ιBƒRƒ}ƒ“ƒh‚ΕŽΐs‚·‚ικ‡‚́AˆΘ‰Ί‚Μ‚ζ‚€‚Ε‚ ‚ιB

 

(py37)c> python AnalEx2AFCR.py

 

ƒvƒƒ“ƒvƒg gn_n =h ‚ͺ•\Ž¦‚³‚κ‚½‚ηAƒJƒeƒSƒŠ‚P‚©‚η‚U‚ά‚Ε‚Μ’ρŽ¦ŽhŒƒ‘ΏπŒ<noise, noise>‚Ι‘Ξ‚·‚ι”»’f‰ρ“š”‚π“ό—Ν‚·‚ιB•\Ex.1‚Μƒf[ƒ^‚Ε‚ ‚κ‚΁AŽŸ‚Μ‚ζ‚€‚ɐ”’l‚π”ΌŠp‹σ”’•ΆŽš‚Ε‹ζΨ‚Α‚Δ•ΐ‚Χ‚ΔΕŒγ‚ΙEnterƒL[‚π‰Ÿ‚΅‚Δ“ό—Ν‚·‚ιB

 

n_n = 2 5 15 21 6 1

 

EnterƒL[‚π‰Ÿ‚·‚ƁAŽŸ‚Μ“ό—Νƒvƒƒ“ƒvƒg‚ͺ•\Ž¦‚³‚κ‚ι‚̂ŁA“―—l‚Ι“ό—Ν‚΅‚Δ‚’‚­B

 

n_n = 2 5 15 21 6 1

n_s =

 

•\Ex.1‚Μƒf[ƒ^‚π‚·‚Χ‚Δ“ό—Ν‚·‚ι‚ƁA’[––‰ζ–Κ‚ΝˆΘ‰Ί‚Μ‚ζ‚€‚Ι‚Θ‚Α‚Δ‚’‚ιB

 

n_n = 2 5 15 21 6 1

n_s = 1 1 13 21 7 7

s_n = 6 10 24 7 3 0

s_s = 6 3 12 21 6 2

 

‚S‚Β‚ΜŽhŒƒ‘Ξ‚Ι‘Ξ‚·‚ιƒf[ƒ^‚Μ“ό—Ν‚ͺI‚ν‚ι‚ƁAMCMCƒTƒ“ƒvƒŠƒ“ƒO‚ͺŽn‚ά‚ιBƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚ΈA‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.1jB

}Ex.1

 

MAP„’θ’l‚ͺ—Η‚’‚±‚Ƃ́A‰ͺ–{i2022Ghttps://doi.org/10.14947/psychono.41.1j‚Ι•ρ‚³‚κ‚Δ‚’‚ιB

}Ex.1‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.2jB

}Ex.2

 

}Ex.2‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒJƒeƒSƒŠ‹«ŠE’lC1, C2, C4, C5‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.3jB

}Ex.3

 

ƒJƒeƒSƒŠ”‚ͺ‹τ”‚Ε‚ ‚ι‚̂ŁAC3‚Ν‚O‚ΙŒΕ’θ‚³‚κ‚Δ‚’‚ι‚ͺA“_i‚OC‚Oj‚̐Ԃ’”Ό‰~‚Ε•\‚³‚κ‚Δ‚’‚ιB

}Ex.3‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒpƒ‰ƒ[ƒ^‚‚‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.4jB

}Ex.4

 

}Ex.4‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA}Ex.5‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.5jB

}Ex.5

 

Še’ρŽ¦ŽhŒƒ‘Ξ‚Ι‘Ξ‚΅‚āA•]’θƒJƒeƒSƒŠ”»’f‚Μ—έΟŠm—¦‚Μƒf[ƒ^’licŽ²j‚Ζƒ‚ƒfƒ‹‚Ι‚ζ‚ι—\‘ͺ’li‰‘Ž²j‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚Δ‚’‚ιB”jό‚Μ‘ΞŠpό‚́Aƒf[ƒ^’l‚Ζƒ‚ƒfƒ‹—\‘ͺ’l‚ͺŠ‘S‚Ιˆκ’v‚΅‚½κ‡‚ΜƒOƒ‰ƒt‚Ε‚ ‚ιBƒf[ƒ^’l‚Ζ—\‘ͺ’l‚ΜŠΦŒW‚́A‚±‚Μ‘ΞŠpό‚Ι‚Ω‚Ϊ‰ˆ‚Α‚Δ‚’‚ι‚̂ŁAƒ‚ƒfƒ‹‚Μƒf[ƒ^‚Ι‘Ξ‚·‚ι“–‚Δ‚Ν‚ά‚θ‚Ν—Η‚’‚Ζ‚’‚¦‚ιB

}Ex.5‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚̏I—Ή‚Ε‚ ‚ιB

ƒOƒ‰ƒt‚̐}‚́AƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹‚Ζ“―‚ΆƒtƒHƒ‹ƒ_‚Ιƒtƒ@ƒCƒ‹‚Ζ‚΅‚Δ•Ϋ‘Ά‚³‚κ‚Δ‚’‚ιB

 

 

 

ƒJƒeƒSƒŠ”‚ͺ‚j‚V‚±‚̏ꍇ

 

ƒŠƒXƒgEx.4‚ΜƒXƒNƒŠƒvƒgAnalEx2AFCR.py‚πŽŸ‚Μ‚ζ‚€‚ΙŽΐs‚·‚ιB

 

(py37) c> python AnalEx2AFCR.py

 

‚ά‚ΈA’ρŽ¦ŽhŒƒ‘΁ƒƒmƒCƒYAƒmƒCƒY„‚Ι‘Ξ‚·‚ιƒf[ƒ^‚Μ“ό—Ν‚ͺ‹‚ί‚η‚κ‚ιB

•\Ex.2‚̏ꍇ‚Μƒf[ƒ^‚πˆΘ‰Ί‚Μ‚ζ‚€‚Ι“ό—Ν‚·‚ιB

•\Ex.2@ƒJƒeƒSƒŠ”‚VŒΒ‚̏ꍇ‚Μƒf[ƒ^

•]’θƒJƒeƒSƒŠ

n-n

n-s

s-n

s-s

1

2

0

5

0

2

7

3

9

7

3

9

10

14

13

4

17

14

11

7

5

11

9

10

13

6

1

10

1

9

7

3

4

0

1

 

Še’l‚π”ΌŠp‹σ”’•ΆŽši‚QŒΒˆΘγ‚Ε‚ΰ‰Βj‚Ε‹ζΨ‚Α‚Δ•ΐ‚ׁAΕŒγ‚ΙEnterƒL[‚π‰Ÿ‚·B

 

n_n = 2 7 9 17 11 1 3

 

EnterƒL[‚π‰Ÿ‚·‚ƁAŽŸ‚Μ“ό—Νƒvƒƒ“ƒvƒg‚ͺ•\Ž¦‚³‚κ‚ι‚̂ŁA“ό—Ν‚΅‚Δ‚’‚­B

 

n_n = 2 7 9 17 11 1 3

n_s = 0 3 10 14 9 10 4

s_n = 5 9 14 11 10 1 0

s_s = 0 7 13 7 13 9 1

 

ƒƒVƒOƒiƒ‹AƒVƒOƒiƒ‹„‚Ι‘Ξ‚·‚ι“ό—Ν‚πI‚¦‚ι‚ƁA‚l‚b‚l‚bƒTƒ“ƒvƒŠƒ“ƒO‚ͺŽn‚ά‚ιB

ƒTƒ“ƒvƒŠƒ“ƒO‚ͺI—Ή‚·‚ι‚ƁA‚ά‚ΈA‚ΜŽ–Œγ•ͺ•z‚Ζ‚l‚`‚o„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.6jB

}Ex.6

 

MAP„’θ’l‚ͺ—Η‚’‚Ζ‚’‚€•ρ‚ͺ‚ ‚ιi‰ͺ–{A2022Ghttps://doi.org/10.14947/psychono.41.1j

}Ex.6‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.7jB

}Ex.7

 

}Ex.7‚π•Β‚Ά‚ι‚ƁA•]’θ‹«ŠE’lC1, C2, C3, C4, C5, C6‚ΜŽ–Œγ•ͺ•z‚ΖMAP„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.8jB

}Ex.8

 

}Ex.8‚π•Β‚Ά‚ι‚ƁAƒpƒ‰ƒ[ƒ^‚‚‚ΜŽ–Œγ•ͺ•z‚Ζ‚l‚`‚o„’θ’l‚ͺ•\Ž¦‚³‚κ‚ιi}Ex.9jB

}Ex.9

 

}Ex.9‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁA}Ex.10‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚ιB

}Ex.10

 

Še’ρŽ¦ŽhŒƒ‘Ξ‚Ι‘Ξ‚΅‚āA•]’θƒJƒeƒSƒŠ”»’f‚Μ—έΟŠm—¦‚Μƒf[ƒ^’licŽ²j‚Ζƒ‚ƒfƒ‹‚Ι‚ζ‚ι—\‘ͺ’li‰‘Ž²j‚ΜƒOƒ‰ƒt‚ͺ•\Ž¦‚³‚κ‚Δ‚’‚ιB”jό‚Μ‘ΞŠpό‚́Aƒf[ƒ^’l‚Ζƒ‚ƒfƒ‹—\‘ͺ’l‚ͺŠ‘S‚Ιˆκ’v‚΅‚½κ‡‚ΜƒOƒ‰ƒt‚Ε‚ ‚ιBƒf[ƒ^’l‚Ζ—\‘ͺ’l‚ΜŠΦŒW‚́A‚±‚Μ‘ΞŠpό‚Ι‚Ω‚Ϊ‰ˆ‚Α‚Δ‚’‚ι‚̂ŁAƒ‚ƒfƒ‹‚Μƒf[ƒ^‚Ι‘Ξ‚·‚ι“–‚Δ‚Ν‚ά‚θ‚Ν—Η‚’‚Ζ‚’‚¦‚ιB

}Ex.10‚ΜƒtƒH[ƒ€‚π•Β‚Ά‚ι‚ƁAƒvƒƒOƒ‰ƒ€‚̏I—Ή‚Ε‚ ‚ιB

ƒOƒ‰ƒt‚̐}‚́AƒXƒNƒŠƒvƒgƒtƒ@ƒCƒ‹‚Ζ“―‚ΆƒtƒHƒ‹ƒ_‚Ιƒtƒ@ƒCƒ‹‚Ζ‚΅‚Δ•Ϋ‘Ά‚³‚κ‚Δ‚’‚ιB

 

 

 

ƒŠƒXƒgEx.1.@³“šŠm—¦Pc‚Μ•`‰ζƒXƒNƒŠƒvƒg

 

import matplotlib.pyplot as plt

from matplotlib import cm

import numpy as np

import scipy.stats as ss

X = np.linspace(0.1, 2.0, 1000)    #   mu_s

Y = np.linspace(0.4, 2.0, 100)     #   sigma_s

Xg, Yg = np.meshgrid(X, Y)

 

def Pc(mu, sgm):

    return  ss.norm.cdf(mu / ((1 + sgm**2)**0.5))

 

Z = np.empty((len(Y), len(X)))

for i in range(len(X)):

    for j in range(len(Y)):

        Z[j][i] = Pc(X[i], Y[j])

 

fig = plt.figure(figsize = (7,6))

ax = fig.add_subplot(111)

C = ax.contourf(Xg, Yg, Z, levels = 20)

ax.set_xlabel('$\mu_s$', fontsize = 16);

ax.set_ylabel('$\sigma_s$', fontsize = 16)

ax.set_title('Pc')

fig.colorbar(C, ax=ax, fraction=0.02, pad=0.1)

plt.tight_layout()

plt.savefig('FigPcCont.png')

plt.show()

 

 

ƒŠƒXƒgEx.2@K‚ͺ‹τ”‚̏ꍇ

 

data {

    int K;

    int nn_cond[K];

    int ns_cond[K];

    int sn_cond[K];

    int ss_cond[K];

}

transformed data {

    int hK;

    vector[K/2] alpha;

    hK = K / 2;

    for (i in 1:hK) {

        alpha[i] = 1.0;

    }

}

parameters {

    real mu_s;

    real<lower = 0.0> sgm_s;

    real b;

    simplex[hK] preC;

}

transformed parameters {

    vector[K] nn_theta;

    vector[K] ns_theta;

    vector[K] sn_theta;

    vector[K] ss_theta;

    vector[K+1] nn_cum_p;

    vector[K+1] ns_cum_p;

    vector[K+1] sn_cum_p;

    vector[K+1] ss_cum_p;

    vector[K-1] C;

    real vsum;

    real sgm_nn;

    real sgm_ns;

    real sgm_ss;

 

    C[hK] = 0.0;

    vsum = 0.0;

    for (i in 1:hK-1) {

        vsum += preC[i];

        C[hK+i] = vsum / (1.0 - vsum);

        C[hK-i] = -C[hK+i];

    }

 

    sgm_nn = sqrt(1.0 + 1.0);

    sgm_ns = sqrt(1.0 + square(sgm_s));

    sgm_ss = sqrt(square(sgm_s)*2);

 

    nn_cum_p[1] = 0.0;

    ns_cum_p[1] = 0.0;

    sn_cum_p[1] = 0.0;

    ss_cum_p[1] = 0.0;

    nn_cum_p[K+1] = 1.0;

    ns_cum_p[K+1] = 1.0;

    sn_cum_p[K+1] = 1.0;

    ss_cum_p[K+1] = 1.0;

   

    for (i in 2:K) {

        nn_cum_p[i] = normal_cdf(C[i-1], b, sgm_nn);

        ns_cum_p[i] = normal_cdf(C[i-1], mu_s + b, sgm_ns);

        sn_cum_p[i] = normal_cdf(C[i-1], -mu_s + b, sgm_ns);

        ss_cum_p[i] = normal_cdf(C[i-1], b, sgm_ss);

    }

 

    for (i in 1:K) {

        nn_theta[i] = nn_cum_p[i+1] - nn_cum_p[i];

        ns_theta[i] = ns_cum_p[i+1] - ns_cum_p[i];

        sn_theta[i] = sn_cum_p[i+1] - sn_cum_p[i];

        ss_theta[i] = ss_cum_p[i+1] - ss_cum_p[i];

    }

}

model {

    mu_s ~ normal(0.0, 1000.0);

    sgm_s ~ exponential(0.001);

    preC ~ dirichlet(alpha);

    b ~ normal(0.0, 1000.0);

    nn_cond ~ multinomial(nn_theta);

    ns_cond ~ multinomial(ns_theta);

    sn_cond ~ multinomial(sn_theta);

    ss_cond ~ multinomial(ss_theta);

}

 

 

ƒŠƒXƒgEx.3@K‚ͺŠο”‚̏ꍇ

 

data {

    int K;

    int nn_cond[K];

    int ns_cond[K];

    int sn_cond[K];

    int ss_cond[K];

}

transformed data {

    int hK;

    vector[(K/2)+1] alpha;

    hK = K / 2;

    for (i in 1:hK+1) {

        alpha[i] = 1.0;

    }

}

parameters {

    real mu_s;

    real<lower = 0.0> sgm_s;

    real b;

    simplex[hK+1] preC;

}

transformed parameters {

    vector[K] nn_theta;

    vector[K] ns_theta;

    vector[K] sn_theta;

    vector[K] ss_theta;

    vector[K+1] nn_cum_p;

    vector[K+1] ns_cum_p;

    vector[K+1] sn_cum_p;

    vector[K+1] ss_cum_p;

    vector[K-1] C;

    real vsum;

    real sgm_nn;

    real sgm_ns;

    real sgm_ss;

 

    vsum = 0.0;

    for (i in 1:hK) {

        vsum += preC[i];

        C[hK+i] = vsum / (1.0 - vsum);

        C[hK+1-i] = -C[hK+i];

    }

 

    sgm_nn = sqrt(1.0 + 1.0);

    sgm_ns = sqrt(1.0 + square(sgm_s));

    sgm_ss = sqrt(square(sgm_s)*2);

 

    nn_cum_p[1] = 0.0;

    ns_cum_p[1] = 0.0;

    sn_cum_p[1] = 0.0;

    ss_cum_p[1] = 0.0;

    nn_cum_p[K+1] = 1.0;

    ns_cum_p[K+1] = 1.0;

    sn_cum_p[K+1] = 1.0;

    ss_cum_p[K+1] = 1.0;

   

    for (i in 2:K) {

        nn_cum_p[i] = normal_cdf(C[i-1], b, sgm_nn);

        ns_cum_p[i] = normal_cdf(C[i-1], mu_s + b, sgm_ns);

        sn_cum_p[i] = normal_cdf(C[i-1], -mu_s + b, sgm_ns);

        ss_cum_p[i] = normal_cdf(C[i-1], b, sgm_ss);

    }

 

    for (i in 1:K) {

        nn_theta[i] = nn_cum_p[i+1] - nn_cum_p[i];

        ns_theta[i] = ns_cum_p[i+1] - ns_cum_p[i];

        sn_theta[i] = sn_cum_p[i+1] - sn_cum_p[i];

        ss_theta[i] = ss_cum_p[i+1] - ss_cum_p[i];

    }

}

model {

    mu_s ~ normal(0.0, 1000.0);

    sgm_s ~ exponential(0.001);

    preC ~ dirichlet(alpha);

    b ~ normal(0.0, 1000.0);

    nn_cond ~ multinomial(nn_theta);

    ns_cond ~ multinomial(ns_theta);

    sn_cond ~ multinomial(sn_theta);

    ss_cond ~ multinomial(ss_theta);

}

 

 

ƒŠƒXƒgEx.4@Šg’£‚QŽˆ‹­§‘I‘π•]’θ–@ƒf[ƒ^‚ΜƒxƒCƒY•ͺΝƒXƒNƒŠƒvƒgiAnalEx2AFCR.pyj

 

import numpy as np

import scipy.stats as ss

import matplotlib.pyplot as plt

import seaborn as sb

import pystan

import sys

 

 

def CalcMAPEst(samples, a = 0.05, n_points = 10000):

    """

        Calculatte a MAP estimate from a KDE graph on [Lp, Up]

        Lp and Up are 100*a/2 and 100(1-a/2) percentile points of samples

    """

    Lp, Up = np.percentile(samples, [100 * a/2, 100 * (1 - a/2)])  # import numpy as np

    coord = np.linspace(Lp, Up, n_points)

    est_pdf = ss.gaussian_kde(samples).pdf(coord)  # import scipy.stats as ss

    map_idx = np.argmax(est_pdf)

    MAP_Est = coord[map_idx]     

    return MAP_Est, est_pdf[map_idx]

 

 

n_n = [int(v) for v in input('n_n = ').split()]

K = len(n_n)

if K < 3:

    print('Number of categories should be larger than 2.')

    sys.exit()

 

n_s = [int(v) for v in input('n_s = ').split()]

if len(n_s) != K:

    print('Numbers of categories are not consistent.')

    sys.exit()

s_n = [int(v) for v in input('s_n = ').split()]

if len(s_n) != K:

    print('Numbers of categories are not consistent.')

    sys.exit()

s_s = [int(v) for v in input('s_s = ').split()]

if len(s_s) != K:

    print('Numbers of categories are not consistent.')

    sys.exit()

print('n_n =', n_n)

print('n_s =', n_s)

print('s_n =', s_n)

print('s_s =', s_s)

 

sm = pystan.StanModel(file = 'SDT_2AFC_KCat_odd.stan' if K % 2 == 1 else 'SDT_2AFC_KCat_even.stan')

 

print('Compiling ended.')

 

Data = {'K':K, 'nn_cond':n_n, 'ns_cond':n_s, 'sn_cond':s_n, 'ss_cond':s_s}

fit = sm.sampling(data = Data, iter = 10000, n_jobs = 1)

print(fit)

 

mu_s_map = CalcMAPEst(fit['mu_s'])[0]

sb.kdeplot(fit['mu_s'])

plt.xlabel('$\mu_s$')

plt.title('$\mu_s$(MAP) = {0:.3f}'.format(mu_s_map))

plt.savefig('Fig_mu.png')

plt.show()

 

sgm_s_map = CalcMAPEst(fit['sgm_s'])[0]

sb.kdeplot(fit['sgm_s'])

plt.title('$\sigma_s$(MAP) = {0:.3f}'.format(sgm_s_map))

plt.xlabel('$\sigma_s$')

plt.savefig('Fig_sgm.png')

plt.show()

 

 

 

s_title = ''

if K % 2 == 1:

    for k in range(K-1):

        sb.kdeplot(fit['C'].T[k])

        c_map = CalcMAPEst(fit['C'].T[k])[0]

        s_title += f'C{k+1}={c_map:.2f}'

        if k < K-2:

            s_title += ', '

   

else:

    for k in range(K-1):

        if k != (K//2) - 1:

            sb.kdeplot(fit['C'].T[k])

            c_map = CalcMAPEst(fit['C'].T[k])[0]

            s_title += f'C{k+1}={c_map:.2f}'

            if k < K-2:

                s_title += ', '

        else:

            plt.plot([0], [0], marker = 'o', markersize = 15, c = 'r')

            s_title += f'C{k+1}=0, '

           

plt.title('MAP estimates\n' + s_title)

plt.savefig('FigC.png')

plt.show()

 

b_map = CalcMAPEst(fit['b'])[0]

sb.kdeplot(fit['b'])

plt.title('b(MAP) = {0:.3f}'.format(b_map))

plt.savefig('Fig_b.png')

plt.show()

 

 

cum_n_n = np.cumsum(n_n)

pcum_n_n = cum_n_n/cum_n_n[-1]

cum_n_s = np.cumsum(n_s)

pcum_n_s = cum_n_s / cum_n_s[-1]

cum_s_n = np.cumsum(s_n)

pcum_s_n = cum_s_n / cum_s_n[-1]

cum_s_s = np.cumsum(s_s)

pcum_s_s = cum_s_s / cum_s_s[-1]

 

est_pcum_n_n = np.median(fit['nn_cum_p'], axis = 0)[1:-1]

est_pcum_n_s = np.median(fit['ns_cum_p'], axis = 0)[1:-1]

est_pcum_s_n = np.median(fit['sn_cum_p'], axis = 0)[1:-1]

est_pcum_s_s = np.median(fit['ss_cum_p'], axis = 0)[1:-1]

 

plt.plot(est_pcum_n_n, pcum_n_n[:-1], label = 'n_n')

plt.plot(est_pcum_n_s, pcum_n_s[:-1], label = 'n_s')

plt.plot(est_pcum_s_n, pcum_s_n[:-1], label = 's_n')

plt.plot(est_pcum_s_s, pcum_s_s[:-1], label = 's_s')

plt.plot([0,1], [0,1], c = 'k', ls = '--', label = 'Obs.=Est.')

plt.xlabel('Est.Cum.P')

plt.ylabel('Obs.Cum.P')

plt.legend()

plt.title('Cumulative Proportions')

plt.savefig('FigCumEstObs.png')

plt.show()

 

 

 

 

ƒf[ƒ^•ͺΝ—p‚ΜPython‰πΰ‘ƒ‰ͺ–{ˆΐ°u‚’‚ά‚³‚η•·‚―‚Θ‚’Python‚Εƒf[ƒ^•ͺΝvŠΫ‘Po”Ł„‚π—pˆΣ‚΅‚½B

 

Home