function [y] = generate_response_vector(X, beta0, eps, model_type, Sigma)


    % inputs:
    % X: design matrix (of dimension n \times p)
    % beta0: signal vector (of dimension p \times 1)
    % eps: noise vector (of dimension n \times 1)
    % output:
    % y: response vector (of dimension n \times 1)
    
    [n, p] = size(X);
        
    if strcmp(model_type, 'lin')
        y = X * beta0 + eps;
    end
    
    if strcmp(model_type, 'nlsq')
        y = zeros(n, 1);
        nlsq_mat = randn(p, p);
        nlsq_mean = trace(Sigma * nlsq_mat);
        for i = 1:n
            y(i) = beta0' * X(i, :)' ...
                + ( X(i, :) * nlsq_mat * X(i, :)' - nlsq_mean ) / p ...
                + eps(i);
                
        end
    end
end