Not a valid target for an assignment
Show older comments
I am trying to do a cross sectional regression and i get the error The expression to the left of the equals sign is not a valid target for an assignment. What should i do?
>> %whole sample CAPM
returns=xlsread('Stock Returns','B2:AE321');
factors=xlsread('Factors','B2:E321');
T=min(size(factors,1),size(returns,1));
beta=ones(30,2);
%Step 1:Time-series regression]
for i=1:30
alpha=[ones(T,1) factors(:,1)];
Y=returns(:,i)-factors(:,4);
coefficients(i,:)=(alpha\Y);
end
%Step 2:Cross-sectional regression
Market_Premium=ones(T,2);
for n=1:T
alpha01=[ones(30,1) coefficients(:,2)
Y=(returns(n,:)-factors(t,4))';
Y=(returns(n,:)-factors(t,4))';
↑
Error: The expression to the left of the equals sign is not a valid target for an assignment.

Accepted Answer
More Answers (0)
Categories
Find more on Support Vector Machine Regression 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!