Assessment of pellet retrieval performance

Pre- vs Post-Implant

In this script, we use a reduced dataset for behavioral performance that does not break the pellet retrievals down in the same detail used for neurophysiological and other behavioral timing characterizations. Qualitatively, we saw that the rats were generally worse at retrieving pellets after a large object was put on their head. Using the retrieval success data that was recorded "online" (i.e. by the technician as she administered the behavioral task), we quantify the relative levels of pellet retrieval both before and after implant, without respect to recovery trends.

Load data

T = readtable(defaults.files('behavior_data_file'));

Get table into correct format

The data has some extra entries from a separate group that was not included in the end study (bilateral implants in CFA, but they used NeuroNexus 4x4 arrays so they were not used).

Do not use rats from "M1-C" group

T(strcmpi(T.Group,'M1-C'),:) = [];
T.Group = categorical(T.Group);
T.Name = categorical(T.Name);

Add categorical variable for "Pre" vs "Post" sessions

T.PrePost = categorical(double(T.Day > 0),[0 1],{'Pre','Post'});

Add numeric variable for Total number of trials (for Binomial GLME)

T.nTotal = round(T.nSuccess ./ T.pct);

Create mask for Exclusions (days where no trials were performed)

Also update N, the vector used to specify the total number of trials. It messes up fitglme if any values are NaN, so set those values to 1.
Excluded = isnan(T.nTotal);
N = T.nTotal;
N(Excluded) = 1;

Create Generalized Linear Mixed-Effects (GLME) Model

Include an Intercept term, a Group*PrePost interaction (and main fixed effects), and random intercept for each animal (Name).
Fit the output as total number of successes using a Binomial Distribution and the total number of trials.
prepost_glme = fitglme(T,"nSuccess~1+PrePost*Group+(1|Name)",...
"Exclude",Excluded,...
"BinomialSize",N,...
"Link","logit",...
"Distribution","Binomial",...
"FitMethod","Laplace",...
"DummyVarCoding","effects",...
"DispersionFlag",true);
disp(prepost_glme);
Generalized linear mixed-effects model fit by ML Model information: Number of observations 223 Fixed effects coefficients 4 Random effects coefficients 10 Covariance parameters 1 Distribution Binomial Link Logit FitMethod Laplace Formula: nSuccess ~ 1 + Group*PrePost + (1 | Name) Model fit statistics: AIC BIC LogLikelihood Deviance 1429.4071085979 1446.44296745521 -709.703554298952 1419.4071085979 Fixed effects coefficients (95% CIs): Name Estimate SE tStat DF pValue Lower {'(Intercept)' } 0.949234887316214 0.10843451671673 8.75399195807694 219 5.62642824466142e-16 0.735526138059703 {'Group_ET-1' } -0.282020512378024 0.10843451671673 -2.60083708506549 219 0.00993321109986482 -0.495729261634534 {'PrePost_Pre' } 0.401221412331987 0.0341687837803898 11.7423381209798 219 5.14964748812336e-25 0.333879681429094 {'Group_ET-1:PrePost_Pre'} 0.192326701300368 0.0341687837803898 5.62872540434842 219 5.52396515179824e-08 0.124984970397475 Upper 1.16294363657272 -0.0683117631215143 0.46856314323488 0.259668432203261 Random effects covariance parameters: Group: Name (10 Levels) Name1 Name2 Type Estimate {'(Intercept)'} {'(Intercept)'} {'std'} 0.318980908689946 Group: Error Name Estimate {'sqrt(Dispersion)'} 1
disp(prepost_glme.Rsquared);
Ordinary: 0.498720976618045 Adjusted: 0.491854140681306

Report mean and 95% confidence intervals for observed values by category

tSub = T(~Excluded,:);
[Group,TID] = findgroups(tSub(:,{'Group','PrePost'}));
TID.Mean = splitapply(@nanmean,tSub.pct,Group); % Return mean percent correct
TID.CB95 = splitapply(@analyze.stat.getCB95,tSub.pct,Group); % Return upper and lower 95%-confidence bounds
TID.CB95 = cell2mat(TID.CB95);
disp(TID);
Group PrePost Mean CB95 _____ _______ _________________ _________________________ ET-1 Pre 0.772222222222222 0.7 0.866666666666667 ET-1 Post 0.532733708267427 0.04 0.88 SHAM Pre 0.806944444444444 0.7 0.883333333333333 SHAM Post 0.7348019438841 0.52 0.92

Test for significant difference in performance of Intact rats specifically

iET1 = T.Group=="ET-1";
tSub = T(iET1,:);
tSub.Group = string(tSub.Group);
tSub.Name = string(tSub.Name);
n = N(iET1);
exc = Excluded(iET1);
prepost_glme_Ischemia = fitglme(tSub,"nSuccess~1+PrePost+(1|Name)",...
"Exclude",exc,...
"BinomialSize",n,...
"Link","logit",...
"Distribution","Binomial",...
"FitMethod","Laplace",...
"DummyVarCoding","effects",...
"DispersionFlag",true);
disp(prepost_glme_Ischemia);
Generalized linear mixed-effects model fit by ML Model information: Number of observations 129 Fixed effects coefficients 2 Random effects coefficients 6 Covariance parameters 1 Distribution Binomial Link Logit FitMethod Laplace Formula: nSuccess ~ 1 + PrePost + (1 | Name) Model fit statistics: AIC BIC LogLikelihood Deviance 951.449127681202 960.028564894287 -472.724563840601 945.449127681202 Fixed effects coefficients (95% CIs): Name Estimate SE tStat DF pValue Lower Upper {'(Intercept)'} 0.6674085478391 0.166517891896624 4.0080290486348 127 0.000103720094689172 0.337899690476522 0.996917405201679 {'PrePost_Pre'} 0.595425433959527 0.0424380005699029 14.0304780141269 127 1.37870386188683e-27 0.511448289418073 0.679402578500982 Random effects covariance parameters: Group: Name (6 Levels) Name1 Name2 Type Estimate {'(Intercept)'} {'(Intercept)'} {'std'} 0.3947628794273 Group: Error Name Estimate {'sqrt(Dispersion)'} 1
disp(prepost_glme_Ischemia.Rsquared);
Ordinary: 0.476193675513059 Adjusted: 0.47206921626513
iSHAM = T.Group=="SHAM";
tSub = T(iSHAM,:);
tSub.Name = string(tSub.Name);
tSub.Group = string(tSub.Group);
n = N(iSHAM);
exc = Excluded(iSHAM);
prepost_glme_Intact= fitglme(tSub,"nSuccess~1+PrePost+(1|Name)",...
"Exclude",exc,...
"BinomialSize",n,...
"Link","logit",...
"Distribution","Binomial",...
"FitMethod","Laplace",...
"DummyVarCoding","effects",...
"DispersionFlag",true);
disp(prepost_glme_Intact);
Generalized linear mixed-effects model fit by ML Model information: Number of observations 94 Fixed effects coefficients 2 Random effects coefficients 4 Covariance parameters 1 Distribution Binomial Link Logit FitMethod Laplace Formula: nSuccess ~ 1 + PrePost + (1 | Name) Model fit statistics: AIC BIC LogLikelihood Deviance 482.237357659919 489.867242006729 -238.118678829959 476.237357659919 Fixed effects coefficients (95% CIs): Name Estimate SE tStat DF pValue Lower Upper {'(Intercept)'} 1.22421701678796 0.0534811739227545 22.8906160241763 92 9.27578236813384e-40 1.1179987890455 1.33043524453043 {'PrePost_Pre'} 0.206059806933255 0.0534811739227513 3.85294098500698 92 0.000215736214775868 0.0998415791907954 0.312278034675715 Random effects covariance parameters: Group: Name (4 Levels) Name1 Name2 Type Estimate {'(Intercept)'} {'(Intercept)'} {'std'} 3.69298550106962e-08 Group: Error Name Estimate {'sqrt(Dispersion)'} 1
disp(prepost_glme_Intact.Rsquared);
Ordinary: 0.100959714563775 Adjusted: 0.0911875375481638