function yhat = predlasso(y,x,x0,alpha)
% When alpha==1, it is lasso.
nVar = 2; % The maximum number of variables to be selected.
n = length(y);
[B,FitInfo] = lasso(x,y,'Alpha',alpha);
idxnVar = sum(FitInfo.DF>nVar)+1;
index = B(:,idxnVar)>1e-4;
Q = [ones(n,1) x(:,index')];
b = (Q'*Q)\(Q'*y);
yhat = [1;x0(index)]'*b;
