function  [T, SSP, SLI, SC, SP, SP_sec, SSP_sec, SLI_sec] = supplyside(mu, theta, sigma_c, sigma, Omega, alpha, beta)


    N = length(Omega);

    beta                  = [beta;0];

    % Cost-based IO variables

    Omega_tilde           = [Omega, alpha; zeros(1,N+1)];
    Psi_tilde             = (eye(N+1)-Omega_tilde)^(-1);
    Domar_tilde           = (beta' * Psi_tilde)';
    Lambda_tilde          = Domar_tilde(N+1);
    Domar_tilde           = Domar_tilde(1:N);

    % Revenue-based IO variables

    mu                    = [mu;1];
    Omega                 = diag(mu)^(-1) * Omega_tilde;
    Psi                   = (eye(N+1)-Omega)^(-1);
    Domar                 = (beta' * Psi)';
    Lambda                = Domar(N+1);
    Domar                 = Domar(1:N);

    % Sticky-price IO variables

    theta_trans           = [theta;1];
    Psi_hat               = (eye(N+1)-diag(theta_trans) * Omega_tilde)^(-1);
    Domar_hat             = (beta' * Psi_hat)';
    Lambda_hat            = Domar_hat(N+1);
    Domar_hat             = Domar_hat(1:N);


    % Reallocation due to substitution in consumption
    SC = sigma_c * weightedcov(Psi_hat(:,N+1), Psi(:,N+1), beta)/Lambda;

    % Reallocation due to substitution in production
    SP_sec = zeros(N,1);

    for j = 1:N
    SP_sec(j) = sigma(j) * Domar(j)/mu(j) * weightedcov(Psi_hat(:,N+1), Psi(:,N+1), Omega_tilde(j,:))/Lambda;
    end

    SP = sum(SP_sec);

    % Substitution between sectoral products (by sector)
    SSP_sec = zeros(N,1);

    for j = 1:N
        if Omega_tilde(j,N+1) < 1
            SSP_sec(j) = sigma(j) * Domar(j)/mu(j) * (1-Omega_tilde(j,N+1)) * weightedcov(Psi_hat(1:N,N+1), Psi(1:N,N+1), Omega_tilde(j,1:N))/Lambda;
        end   
    end

    % Substitution between labor and intermediate inputs (by sector)   
    SLI_sec = SP_sec - SSP_sec;

    
    SSP = SC + sum(SSP_sec);

    SLI  = sum(SLI_sec);

    % Total effect
    T = SSP + SLI;


    
end