Clear Filters
Clear Filters

Equality constraint not being satisfied using lsqlin or lse

2 views (last 30 days)
I am running a regression over global equity excess returns. My regressor variables are a binary variable for country (of which there are 55), a binary variable for industry (of which there are 34) and then 8 style factors (liquidity, volatility, etc). I have anywhere between 40,000 and 70,000 stocks depending on the month. My constraints are that the sum of the market caps for each industry times the corresponding beta value is zero. The other constraint is there same idea, but for countries. The point of this is to reduce the 'double' collinearity problem. I am getting an answer when I use lsqlin, but when I check the constraints, they are summing to a positive/negative integer depending on the month which is strange because I am getting beta values. Any idea why my constraints wouldnt be satisfied? Also I tried a single value decomposition approach using lse from fileshare and got similar results. Here is some of my code for reference.
constraint_matrix = vertcat(sum_country_weights1, sum_industry_weights1);
regressor_matrix = [world_vector country_factor_exposures industry_factor_exposures sorted_style_weights];
for j = 1:length(regressor_matrix)
for k = 1:numel(regressor_matrix(1,:))
regressor_matrix(j,k) = regressor_matrix(j,k)*root_sorted_market_cap(j);
end
end
for j = 1:numel(sorted_excess_returns)
sorted_excess_returns(j) = sorted_excess_returns(j)*root_sorted_market_cap(j);
end
options = optimset('maxfunevals',1e5, 'maxiter', 1e3, 'display','on');
x = lsqlin(regressor_matrix,sorted_excess_returns, [],[], constraint_matrix, zero_vector,[],[],[],options);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!