예제 #1
0
def exp1ModelBuild(dm):

	"""
	desc:
		Creates optimal models for exp 3. A full interactive model for the
		full dataset, and non-interactive models for each of the subsets,
		split by scene type and instruction.

	arguments:
		dm:
			type:	DataMatrix.
	"""

	assert(exp in ['exp1', 'expAll'])
	modelRandomEffects = '(1|file)'
	modelCandidateFixedEffects = stats.modelCandidateFixedEffects[:-1]

	lfe = stats.modelBuild(dm, suffix='.full',
		modelRandomEffects=modelRandomEffects,
		modelCandidateFixedEffects=modelCandidateFixedEffects)

	model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' % (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp1/model.indirect.csv')

	model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp1/model.direct.csv')
예제 #2
0
def exp1BestPupil(dm):

	"""
	desc:
		Determines which of the various pupil-size transforms is the best
		predictor of saliency.

	arguments:
		dm:
			type:	DataMatrix.
	"""

	modelRandomEffects = '(1|file)'
	modelCandidateFixedEffects = stats.modelCandidateFixedEffects[:-1]
	lfe = stats.modelBuild(dm, suffix='.full',
		modelRandomEffects=modelRandomEffects,
		modelCandidateFixedEffects=modelCandidateFixedEffects)
	model = 'salFrom ~ %s + %%s + (1+%%s|file)' % (' + '.join(lfe))
	stats.R.load(dm)
	for m in range(1, 7):
		_model = model % ('pupilSize%d' % m, 'pupilSize%d' % m)
		lm = stats.R.lmer(_model, lmerVar='model%d' % m)
		lm._print('model%d' % m)
		lm.save('output/%s/bestPupil/lmer.pupilSize%d.csv' % (exp, m))
	m1 = 1
	for m2 in range(2, 7):
		am = stats.R.anova('model%s' % m1, 'model%s' % m2)
		am._print('%s - %s' % (m1, m2))
		am.save('output/%s/bestPupil/anova.pupilSize%d-%d.csv' \
			% (exp, m1, m2))
예제 #3
0
def exp2ModelBuild(dm):

	"""
	desc:
		Creates optimal models for exp 2. A full interactive model for the
		full dataset, and non-interactive models for each of the subsets,
		split by scene type and instruction.

	arguments:
		dm:
			type:	DataMatrix.
	"""

	assert(exp == 'exp2')
	modelRandomEffects = '(1|file)'
	modelCandidateFixedEffects = stats.modelCandidateFixedEffects[:-1]

	lfe = stats.modelBuild(dm, suffix='.full',
		modelRandomEffects=modelRandomEffects,
		modelCandidateFixedEffects=modelCandidateFixedEffects)
	model = 'salFrom ~ %s + pupilSize*inst*sceneType + (1+pupilSize+inst+sceneType|file)' \
		% (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp2/model.indirect.interactionMainRandom.csv')
	model = 'salFrom ~ pupilSize*inst*sceneType + (1+pupilSize+inst+sceneType|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp2/model.direct.interactionMainRandom.csv')

	model = 'salFrom ~ %s + pupilSize*inst + pupilSize*sceneType + (1+pupilSize+inst+sceneType|file)' \
		% (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp2/model.indirect.splitInteractionMainRandom.csv')
	model = 'salFrom ~ pupilSize*inst + pupilSize*sceneType + (1+pupilSize+inst+sceneType|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp2/model.direct.splitInteractionMainRandom.csv')

	model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' % (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp2/model.indirect.csv')
	model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp2/model.direct.csv')

	for sceneType in dm.unique('sceneType'):
		for inst in dm.unique('inst'):
			_dm = dm.select('sceneType == "%s"' % sceneType) \
				.select('inst == "%s"' % inst)
			lfe = stats.modelBuild(_dm, suffix='.%s.%s' % (sceneType, inst),
				modelRandomEffects=modelRandomEffects,
				modelCandidateFixedEffects=modelCandidateFixedEffects)
			model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' \
				% (' + '.join(lfe))
			lm = stats.R.lmer(model)
			lm._print('Indirect model')
			lm.save('output/exp2/model.indirect.%s.%s.csv' % (sceneType, inst))
			model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
			lm = stats.R.lmer(model)
			lm._print('Direct model')
			lm.save('output/exp2/model.direct.%s.%s.csv' % (sceneType, inst))

	for sceneType in dm.unique('sceneType'):
		_dm = dm.select('sceneType == "%s"' % sceneType)
		lfe = stats.modelBuild(_dm, suffix='.%s' % sceneType,
			modelRandomEffects=modelRandomEffects,
			modelCandidateFixedEffects=modelCandidateFixedEffects)
		model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' \
			% (' + '.join(lfe))
		lm = stats.R.lmer(model)
		lm._print('Indirect model')
		lm.save('output/exp2/model.indirect.%s.csv' % sceneType)
		model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
		lm = stats.R.lmer(model)
		lm._print('Direct model')
		lm.save('output/exp2/model.direct.%s.csv' % sceneType)

	for inst in dm.unique('inst'):
		_dm = dm.select('inst == "%s"' % inst)
		lfe = stats.modelBuild(_dm, suffix='.%s' % inst,
			modelRandomEffects=modelRandomEffects,
			modelCandidateFixedEffects=modelCandidateFixedEffects)
		model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' \
			% (' + '.join(lfe))
		lm = stats.R.lmer(model)
		lm._print('Indirect model')
		lm.save('output/exp2/model.indirect.%s.csv' % inst)
		model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
		lm = stats.R.lmer(model)
		lm._print('Direct model')
		lm.save('output/exp2/model.direct.%s.csv' % inst)
예제 #4
0
def exp3ModelBuild(dm):

	"""
	desc:
		Creates optimal models for exp 3. A full interactive model for the
		full dataset, and non-interactive models for each of the subsets,
		split by scene type and instruction.

	arguments:
		dm:
			type:	DataMatrix.
	"""

	assert(exp == 'exp3')
	modelRandomEffects = '(1|file)'
	modelCandidateFixedEffects = stats.modelCandidateFixedEffects[:-1]

	lfe = stats.modelBuild(dm, suffix='.full',
		modelRandomEffects=modelRandomEffects,
		modelCandidateFixedEffects=modelCandidateFixedEffects)

	model = 'salFrom ~ %s + cond + (1+cond|file)' % (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp3/model.cond.indirect.csv')

	model = 'salFrom ~ cond + (1+cond|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp3/model.cond.direct.csv')

	model = 'salFrom ~ %s + pupilSize*cond + (1+pupilSize+cond|file)' \
		% (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp3/model.indirect.interactionMainRandom.csv')

	model = 'salFrom ~ pupilSize*cond + (1+pupilSize+cond|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp3/model.direct.interactionMainRandom.csv')

	model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' % (' + '.join(lfe))
	lm = stats.R.lmer(model)
	lm._print('Indirect model')
	lm.save('output/exp3/model.indirect.csv')

	model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
	lm = stats.R.lmer(model)
	lm._print('Direct model')
	lm.save('output/exp3/model.direct.csv')

	for cond in dm.unique('cond'):
		_dm = dm.select('cond == "%s"' % cond)
		lfe = stats.modelBuild(_dm, suffix='.%s' % cond,
			modelRandomEffects=modelRandomEffects,
			modelCandidateFixedEffects=modelCandidateFixedEffects)
		model = 'salFrom ~ %s + pupilSize + (1+pupilSize|file)' \
			% (' + '.join(lfe))
		lm = stats.R.lmer(model)
		lm._print('Indirect model')
		lm.save('output/exp3/model.indirect.%s.csv' % cond)
		model = 'salFrom ~ pupilSize + (1+pupilSize|file)'
		lm = stats.R.lmer(model)
		lm._print('Direct model')
		lm.save('output/exp3/model.direct.%s.csv' % cond)