From b1f13b9f7c26c560a48564f7a476da65b128c661 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 11 Jan 2016 11:18:50 +0000 Subject: [PATCH] fixed spelling mistake + misc --- ddToolbox/classes/ModelBaseClass.m | 1 - .../{ModelSeperate.m => ModelSeparate.m} | 24 ++++++++-------- .../{seperateME.txt => separateME.txt} | 0 demo/SCRIPT.m | 28 ++++++++++--------- 4 files changed, 27 insertions(+), 26 deletions(-) rename ddToolbox/classes/{ModelSeperate.m => ModelSeparate.m} (88%) rename ddToolbox/jagsModels/{seperateME.txt => separateME.txt} (100%) diff --git a/ddToolbox/classes/ModelBaseClass.m b/ddToolbox/classes/ModelBaseClass.m index bd9df34b..52456117 100644 --- a/ddToolbox/classes/ModelBaseClass.m +++ b/ddToolbox/classes/ModelBaseClass.m @@ -324,7 +324,6 @@ function figParticipant(obj, pSamples, pData, mMEAN, cMEAN, epsilonMEAN, alphaME function figUnivariateSummary(obj, participantIDlist, variables) % loop over variables provided, plotting univariate summary % statistics. - warning('Add group-level inferences to this plot (glM, glC, glALPHA,glEpsilon)') figure for v = 1:numel(variables) subplot(numel(variables),1,v) diff --git a/ddToolbox/classes/ModelSeperate.m b/ddToolbox/classes/ModelSeparate.m similarity index 88% rename from ddToolbox/classes/ModelSeperate.m rename to ddToolbox/classes/ModelSeparate.m index 5d741bff..8f455146 100644 --- a/ddToolbox/classes/ModelSeperate.m +++ b/ddToolbox/classes/ModelSeparate.m @@ -1,4 +1,4 @@ -classdef ModelSeperate < ModelBaseClass +classdef ModelSeparate < ModelBaseClass %ModelSeperate A model to estimate the magnitide effect. % Models a number of participants, but they are all treated as independent. % There is no group-level estimation. @@ -10,14 +10,14 @@ methods (Access = public) % CONSTRUCTOR ===================================================== - function obj = ModelSeperate(toolboxPath, sampler, data, saveFolder) + function obj = ModelSeparate(toolboxPath, sampler, data, saveFolder) % Because this class is a subclass of "ModelBaseClass" then we use % this next line to create an instance obj = obj@ModelBaseClass(toolboxPath, sampler, data, saveFolder); switch sampler case{'JAGS'} - obj.sampler = JAGSSampler([toolboxPath '/jagsModels/seperateME.txt']) + obj.sampler = JAGSSampler([toolboxPath '/jagsModels/separateME.txt']) [~,obj.modelType,~] = fileparts(obj.sampler.fileName); case{'STAN'} error('NOT IMPLEMENTED YET') @@ -29,40 +29,40 @@ %% Create variables % ------------------------------------------------------------------- % Participant-level ------------------------------------------------- - m = Variable('m','m', [], true) + m = Variable('m','m', [], true); m.seed.func = @() normrnd(-0.243,10); m.seed.single = false; - mprior = Variable('mprior','mprior', [], true) + mprior = Variable('mprior','mprior', [], true); mprior.seed.func = @() normrnd(-0.243,10); mprior.seed.single = true; - c = Variable('c','c', [], true) + c = Variable('c','c', [], true); c.seed.func = @() normrnd(0,10); c.seed.single = false; - cprior = Variable('cprior','cprior', [], true) + cprior = Variable('cprior','cprior', [], true); cprior.seed.func = @() normrnd(0,10); cprior.seed.single = true; - epsilon = Variable('epsilon','\epsilon', [0 0.5], true) + epsilon = Variable('epsilon','\epsilon', [0 0.5], true); epsilon.seed.func = @() rand/2; epsilon.seed.single = false; - epsilonprior = Variable('epsilonprior','\epsilon prior', [0 0.5], true) + epsilonprior = Variable('epsilonprior','\epsilon prior', [0 0.5], true); epsilonprior.seed.func = @() rand/2; epsilonprior.seed.single = true; - alpha = Variable('alpha','\alpha', 'positive', true) + alpha = Variable('alpha','\alpha', 'positive', true); alpha.seed.func = @() abs(normrnd(0,10)); alpha.seed.single = false; - alphaprior = Variable('alphaprior','\alpha prior', 'positive', true) + alphaprior = Variable('alphaprior','\alpha prior', 'positive', true); alphaprior.seed.func = @() abs(normrnd(0,10)); alphaprior.seed.single = true; % posterior predictive ---------------------------------------------- - Rpostpred = Variable('Rpostpred','Rpostpred', [0 1], true) + Rpostpred = Variable('Rpostpred','Rpostpred', [0 1], true); Rpostpred.plotMCMCchainFlag = false; % define which to analyse (univariate analysis) diff --git a/ddToolbox/jagsModels/seperateME.txt b/ddToolbox/jagsModels/separateME.txt similarity index 100% rename from ddToolbox/jagsModels/seperateME.txt rename to ddToolbox/jagsModels/separateME.txt diff --git a/demo/SCRIPT.m b/demo/SCRIPT.m index d724884b..83366095 100644 --- a/demo/SCRIPT.m +++ b/demo/SCRIPT.m @@ -122,23 +122,25 @@ % order to have more reliable MCMC chain convergence. % This new model is called ModelHierarchicalUpdated -saveFolder = 'hierarchical_updated_priors'; -uModel = ModelHierarchicalUpdated(toolboxPath, 'JAGS', myData, saveFolder); -uModel.sampler.setMCMCtotalSamples(10^5); -uModel.conductInference(); -uModel.posteriorPredictive(); -uModel.exportParameterEstimates(); -uModel.plot() -uModel.plotMCMCchains() - - -%% CODE FOR PARTICIPANT-LEVEL ONLY INFERENCE IS EXPERIMENTAL... NOT RECOMMENDED -% % PARTICIPANT-LEVEL ONLY INFERENCES +% saveFolder = 'hierarchical_updated_priors'; +% uModel = ModelHierarchicalUpdated(toolboxPath, 'JAGS', myData, saveFolder); +% uModel.sampler.setMCMCtotalSamples(10^5); +% uModel.conductInference(); +% uModel.posteriorPredictive(); +% uModel.exportParameterEstimates(); +% uModel.plot() +% uModel.plotMCMCchains() + + +%% CODE FOR PARTICIPANT-LEVEL ONLY +% THIS IS CURRENTLY EXPERIMENTAL. IT WORKS FINE WITH THE DEMO DATASET, BUT +% I HAVE BEEN HAVING MCMC CHAIN CONVERGENCE ISSUES WITH OTHER DATASETS. + % % If you want to avoid group-level hierarchical inference, then you can use % % a different model class. Code below shows an example % % saveFolder = 'nonHierarchical'; -% sModel = ModelSeperate(toolboxPath, 'JAGS', myData, saveFolder); +% sModel = ModelSeparate(toolboxPath, 'JAGS', myData, saveFolder); % sModel.sampler.setMCMCtotalSamples(10^5); % sModel.conductInference(); % sModel.posteriorPredictive();