(MATLAB)
function dataMat = genFakeData(nRep)
rng(‘shuffle’);
if nRep<1
error(‘nRep must be 1 or greater’);
end
if nRep ~= round(nRep)
error(‘nRep must be a whole number’);
end
var1 = [1 1 2 2]; % IV1: first two at level 1, second two atlevel 2 v
ar2 = [1 2 1 2]; % IV2: first & third at level 1, second& fourth at lvl 2
dataMat = [var1′ var2′];
dataMat = repmat(dataMat,nRep,1); % THINK: what do nRep and 1represent?
nTrials = size(dataMat,1);
trialNums = (1:nTrials)’;
correct = round(rand(nTrials,1));
dataMat = [trialNums dataMat correct];
QUESTION: Modify genFakedata Add a new input argument togenFakeData2 called nLevels. This will change the number of levelsof each variable (as opposed to
PayPal Gateway not configured
PayPal Gateway not configured