# 201 Final

Jun 20th, 2021
778
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. % Again Part of my 201 Class
2. % removed identifying features
3. % Similar to Final Exam Applications paste
4.
5. %% Question 1b
6. clc, clear, clf
7.
8. % Virus Values
9. VmaxVirus = 0.75;   % Vmax for Virus
10. KmVirus = 5.7;      % Km for Virus
11. C = logspace(-2, 4);        % Creating equally spaced log vector from 10^-2 to 10^4
12. VobsVirus = (VmaxVirus.*C)./(C+KmVirus);    % Vobs function for Virus in terms of Vmax, Km, and variable
13.
14. % Human Values
15. VmaxHuman = 0.81;       % Vmax for Human
16. KmHuman = 21;           % Km for Human
17. VobsHuman = (VmaxHuman.*C)./(C+KmHuman);        % Creating Vobs for Human in terms of Vmax, KM, and variable
18.
19. % Graphing the functions
20. hold on         % Hold on so I can plot two functions on one figure
21. semilogx(VobsVirus)         % Plotting Virus function on log x-axis
22. semilogx(VobsHuman)         % Plotting Human function on log x-axis
23. title('V Observed vs. Concentration of Remdesivir-TP for Human and Virus')      % Title for figure
24. legend('Virus', 'Human', 'Location', 'best')    % Creating legend to differentiate between functions in the best location
25. xlabel('Concentration of Remdesivir-TP(uM)')    % Horizontal label
26. ylabel('V Observed')            % Vertical label
27. hold off        % Removes hold on graph
28. %% Question 1c
29.
30. V = [0.01 0.1 1 10]        % [uM] Creating a concentration vector
31. VobsV = (VmaxVirus.*V)./(V+KmVirus)        % Creating Vobs function for Virus with set concentrations
32. VobsH = (VmaxHuman.*V)./(V+KmHuman)        % Creating Vobs function for Human with set concentrations
33. TW = VobsV - VobsH         % Therapeutic window
34. %% Question 2a
35. clc, clear, clf
36.
37. s1 = table([84;16],[80;20],'VariableNames',{'Experimental','Placebo'},'RowNames',{'Lived', 'Died'})         % Creating table for scenario 1
38. s2 = table([840;160],[800;200],'VariableNames',{'Experimental','Placebo'},'RowNames',{'Lived', 'Died'})     % Creating table for scenario 2
39. [h1, p1, stats1] = fishertest(s1)       % Performing fisher's exact test on scenario 1 and getting values from results
40. [h2, p2, stats2] = fishertest(s2)       % Performing fisher's exact test on scenario 2 and getting values from results
41. %% Question 2b
42. clc, clear, clf
43.
44. CohortSize =[20 200 2000 20000];       % Creating cohort sizes vector
45.
46. for i = 1:length(CohortSize)      % Beginning of the for loop that runs for length of the cohort vector
47.     C = CohortSize(i);          % Reallocating the cohort size into a vector with a smaller name
48.     b = C/2 * 0.80;      % Taking half of the cohort size and then saying 80% of this new group will live with placebo arm
49.     d = C/2 * 0.20;     % Taking half of the cohort size and then saying 20% of this new group will die with placebo arm
50.     c = d*.80;        % The number of patient who died with the experimental arm happens to be 80% in value of patients who died with the placebo arm
51.     a = C/2 - c;       % Taking half of cohort size and subtracting the amount of the patients who died with experimental arm leaves the survivors with experimental arm
52.     s = [a b
53.          c d];          % Creating vector for the contingency table
54.     s = round(s);       % round all the numbers within the vector
55.     [~, P(i), ~] = fishertest(s);      % Perform the fisher's exact test and saving the p-values
56.
57. end         % end for loop
58.
59.
60. semilogy(CohortSize, P)         % Plot p-values vs. cohort size with log y-axis
61. xlabel('Cohort Size')           % horizontal label
62. ylabel('p-values')      % vertical label
63. title('p-values vs. Cohort Size')       % Title for figure
64.
RAW Paste Data