regress command with a binary predictor
Show older comments
I am trying to see whether being rewarded '1' or not rewarded '0' in trial 't' predicts latency of responding in trial 't+1'. I have. e.g., two vectors:
y = [5678 6790 8904] %these are the latencies in trial t+1 in responding
x = [1 1 0] %these are the outcome of t, where 1 is rewarded and 0 is non rewarded
(I'm coming up with fake data, but just to give an example)
I'm doing now [b,bint,r,rint,stats] = regress(y,X) but notice some weird things:
1) not sure whether this is the right way of doing it
2) I have to put the vectors y' and x' otherwise it gives me error
3) for the 'stats' part it gives me NaN for F and p-value, does this mean it is not significant?
I also tried doing
table_latencies = table(y, x) table_latencies.x = nominal(table_latencies.x)
fit = fitlm(table_latencies,'y~x')
But I get this error:
Error using classreg.regr.FitObject/selectVariables (line 293) Predictor variables must be numeric vectors, numeric matrices, or categorical vectors.
Error in classreg.regr.TermsRegression/selectVariables (line 260) model = selectVariables@classreg.regr.ParametricRegression(model);
Error in classreg.regr.FitObject/doFit (line 91) model = selectVariables(model);
Error in LinearModel.fit (line 1215) model = doFit(model);
Error in fitlm (line 117) model = LinearModel.fit(X,varargin{:});
Don't understand why, Thanks!!
Answers (0)
Categories
Find more on Reinforcement Learning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!