Skip to content

Commit

Permalink
fixed spelling mistake + misc
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Vincent committed Jan 11, 2016
1 parent b61062d commit b1f13b9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
1 change: 0 additions & 1 deletion ddToolbox/classes/ModelBaseClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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')
Expand All @@ -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)
Expand Down
File renamed without changes.
28 changes: 15 additions & 13 deletions demo/SCRIPT.m
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b1f13b9

Please sign in to comment.