Explicit solution not found using solve

I have a factor model with only one factor - the market excess return and the returns of fifteen companies. I run a regression and estimate fifteen betas. Then I have to construct a mimicking portfolio of the market factor. I try to solve the question with matrices and write (I pre-specified the 15x1 vector of zeros thetaa,don't know if this is correct):
syms thetaa
solve(thetaa*beta'==1,sum(thetaa)==1)
Then I get the following:
Warning: 16 equations in 1 variables.
> In C:\Program Files (x86)\toolbox\symbolic\symbolic\symengine.p>symengine at 54
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 160
Warning: Explicit solution could not be found.
> In solve at 169
Any suggestions will be appreciated!

 Accepted Answer

Brian B
Brian B on 2 Mar 2013
Edited: Brian B on 2 Mar 2013
I know nothing about mimicking portfolios, but I do know that anything you assign to thetaa is lost when you call
syms thetaa
That means that mupad (the symbolic solver MATLAB is using) interprets
thetaa*beta'
as a scalar-vector multiplication, instead of matrix multiplication. That causes
thetaa*beta'==1
to be interpreted as a vector of 15 equations in the single (scalar) variable thetaa. You add one more, which effectively says thetaa==1, and voilà! There is no solution unless beta is a vector of ones!

19 Comments

Thanks for your comment! I've done
clear...syms
and then:
[thetaa]=solve(thetaa'*beta==1,sum(thetaa)==1) (I made a mistake with the transpose the first time, now it should be right).
I have pre-specified thetaa as a 15x1 vector of zeros once again (since I am not using syms, I guess this is correct, otherwise Matlab says "unknown variable thetaa". However, I get the same outcome:
[thetaa]=solve(thetaa'*beta==1,sum(thetaa)==1)
Warning: Explicit solution could not be found.
> In solve at 169
thetaa =
[ empty sym ]
Brian B
Brian B on 2 Mar 2013
Edited: Brian B on 2 Mar 2013
Is beta a numeric (15 x 15) matrix?
N =B>=>2
N =B>=>2 on 2 Mar 2013
Edited: N =B>=>2 on 2 Mar 2013
beta is a 15x1 vector
Are you trying to estimate 15 components of thetaa?
If beta is a 15x1 vector, then tetaa'*beta is a scalar, so you only have two equations. Thus the solution (if it exists), cannot be unique.
Exactly, I am trying to estimate 15 components of theta. The product theta'*beta should be equal to one and then the sum of the elements of the theta should also be equal to one for my mimicking portfolio. I tried to solve the problem explicitly for the 15 components individually. But then I write the long equation: a*beta1 + b*beta2.....and so on. The problem with this is that I want 15 outputs, but have only two equations. That is why I am trying to solve the problem directly with matrices.
You can find a solution with
thetaa = [1 1]/[ones(15,1) beta];
But there are either no solutions (for example, if beta = zeros (15,1)) or there are an infinite number of them.
The notation here is meant to remind you of a scalar linear equation:
1 = theta*beta => theta = 1/beta
I used: thetaa = [1 1]/[ones(15,1) beta];
This is what I've got for thetaa:
0
0
0
0
0
0
0
0
0.5264
0
0
0
0
0
0.4736
which is a bit odd. Ideally, I would like to have a value different from zero for all 15 weights.
There are solutions with lots of non-zero entries, but which one should you choose? Try this:
N = null([ones(15,1) beta].').';
Then FOR ANY 1x13 vector v
thetaprime = thetaa + v*N
is ALSO a solution. For example,
(thetaa + randn(1,13)*N)*[ones(15,1) beta]
Thus you cannot say much about particular entries of your solution. You need more equations to get any meaningful results.
Maybe this is the moment to provide some additional information: for my portfolio to be the mimicking portfolio, I also need to minimize its variance. So perhaps I need to use an optimization routine as well in order to choose THE answer from so many possibilities
Ah, well, I told you from the beginning that I don't know a thing about mimicking portfolios! :)
Apologies, should have mentioned that in the very beginning. Still a Matlab rookie....Can you please synthesize how to proceed in order to get these many non-zero entries. Then perhaps I will come up with a solution for the optimization routine
I did: pick a random 1x13 vector and multiply by N as above, and add it to the particular solution thetaa that you found previously.
Out of curiosity, what is the variance that you want to minimize?
i would like to minimize the variance of the resulting portfolio, which is given by:
thetaa*sigma*thetaa' (sigma is a 15x15 variance-covariance matrix that I have already obtained)
Well, that is easy. Just use the pseudoinverse
B = [ones(15,1) beta];
c = [1 1];
thetaa = c*((B.'*sigma*B)\B.')
EDIT: I wrote that formula from the top of my head, and it is wrong. The real answer is (using inv instead of / and \ for clarity)
thetaa = (c*inv(B.'*inv(sigma)*B)*B.'*inv(sigma)).';
Thank you very much for your help! Do I still need to minimize anything after this?
That solution DOES minimize the variance thetaa*sigma*thetaa'.
I'd buy you a pint if I knew you. Thanks for the help once again! Much appreciated
Just mark the answer as accepted. :)
Note that I was wrong with the first formula I wrote. It is a solution, but not the minimum variance solution. The correct formula, noted above and restated here for clarity, is
thetaa = (c*inv(B.'*inv(sigma)*B)*B.'*inv(sigma)).';

Sign in to comment.

More Answers (2)

N =B>=>2
N =B>=>2 on 2 Mar 2013
Edited: N =B>=>2 on 2 Mar 2013
Issue update: I did the following steps:
N = null([ones(15,1) beta].').';
thetaprime = thetaa + randn(1,13)*N
Then this thetaprime changes everytime because of the random vector, but in all cases its components sum up to one. I am trying to minimize this using the following:
B = [ones(15,1) beta];
c = [1 1];
thetaprime = (c*inv(B.'*inv(SIGMA_Questionf)*B)*B.'*inv(SIGMA_Questionf)).';
but it does not seem to work: thetaprime once again changes its values every time (and I need only one answer that gives the minimum variance) and the components do not sum up to one. Any suggestions?

1 Comment

Brian B
Brian B on 3 Mar 2013
Edited: Brian B on 3 Mar 2013
Is this school work?
It doesn't mean you can't get help if it is, but you should clearly state that you are asking about homework when that is the case.

Sign in to comment.

N =B>=>2
N =B>=>2 on 3 Mar 2013
Yes, it is a school work. It is my very first time asking questions here, didn't know I have to state that as well.

1 Comment

Your original question referred to warnings and unexpected behavior, which is clearly appropriate for this forum. But I probably got carried away answering some of the later questions. I am a student, too, and I recognize the greater value of struggling with the concepts compared to having the answer given. Your questions indicate that there are some aspects of the subject that you still need to wrestle with. This is a good time to talk with your professor or TA.
You should feel welcome to continue using this forum for help with MATLAB-specific qustions, but it is good practice to follow some basic guidelines when asking about homework.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!