%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % COPYRIGHT: % Paul Harrison, Laurent Badel, Mark Wall and Magnus JE Richardson % (2014) % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation version 3. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % See for the GNU General Public License % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [ Data_gen_class,Variables ] = Generate_EIF( N ) %GENERATEEIF Generate populations of EIF neuron models of layer 2/3, 4, %slender-tufted layer 5, and thick-tufted layer 5 pyramidal cells. Requires %MATLAB Statistics toolbox. % Input: % N = number of cells to generate. 4x1 vector consisting of the % number required for each class in the order stated above. If the % same number from each class are required just input a single % number. % Output: % Data_gen_class = 4x1 cell array where each element corresponds to % the cell classes in the order stated above (Data_gen_class{1} are % layer 2/3 cells etc.). Each element in the cell array is an N(k)*5 % array of parameter values. Rows correspond to to model neurons and % columns are parameters [C,tau,E,VT,DT]. % Variables = Cell array of variable names. nClass=4;%Number of cell classes if numel(N)==1 N=N*ones(nClass,1); end %% Distribution Parameters Variables={'C';'tau';'E';'VT';'DT'}; DistName={'logn';'logn';'norm';'norm';'logn'}; nVar=numel(DistName);%Number of EIF parameters mu=[4.87 4.86 4.86 5.61;...%C 2.67 2.82 2.88 2.9;...%tau -79.3 -71.8 -69.9 -68.5;...%E -49.5 -48.7 -49.7 -52.7;...%VT .227 .213 .235 .0836];%DT sig=[.258 .289 .251 .273;...%C .171 .24 .255 .229;...%tau 4.27 4.2 4.18 3.98;...%E 3.81 3.53 3.56 3.59;...VT .359 .266 .361 .364];%DT Rho{1}=... [1.0000 -0.2721 0.0042 -0.5636 -0.1307; -0.2721 1.0000 -0.1357 0.4244 -0.4509; 0.0042 -0.1357 1.0000 0.4765 -0.0464; -0.5636 0.4244 0.4765 1.0000 -0.3097; -0.1307 -0.4509 -0.0464 -0.3097 1.0000]; Rho{2}=... [1.0000 0.1124 0.2056 -0.2430 -0.1318; 0.1124 1.0000 0.2773 -0.0053 -0.1034; 0.2056 0.2773 1.0000 0.3427 -0.3416; -0.2430 -0.0053 0.3427 1.0000 -0.4020; -0.1318 -0.1034 -0.3416 -0.4020 1.0000]; Rho{3}=... [1.0000 0.3380 0.4681 -0.1710 -0.2218; 0.3380 1.0000 0.2582 -0.0344 -0.2067; 0.4681 0.2582 1.0000 0.3974 -0.4300; -0.1710 -0.0344 0.3974 1.0000 -0.1410; -0.2218 -0.2067 -0.4300 -0.1410 1.0000]; Rho{4}=... [1.0000 0.0639 0.1435 -0.2865 -0.2151; 0.0639 1.0000 0.0773 -0.0066 -0.2062; 0.1435 0.0773 1.0000 0.3730 0.1508; -0.2865 -0.0066 0.3730 1.0000 0.1949; -0.2151 -0.2062 0.1508 0.1949 1.0000]; %% Generate Random Sample Data_copula_gen=cell(nClass,1); Data_gen_class=cell(nClass,1); for k=1:nClass %Allocate memory Data_copula_gen{k}=zeros(N(k),nVar); Data_gen_class{k}=zeros(N(k),nVar); %Generate a random sample from the t copula Data_copula_gen{k}=copularnd('Gaussian',Rho{k},N(k)); %Transform the random sample back to the original scale of the data for j=1:nVar Data_gen_class{k}(:,j)=icdf(DistName{j},Data_copula_gen{k}(:,j),... mu(j,k),sig(j,k)); end end end