fig4_3.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. % Local Regression and Likelihood, Figure 4.3.
  2. % Author: Catherine Loader
  3. %
  4. % Residual plots for local likelihood.
  5. % Henderson-Shepherd Mortality Data.
  6. load morths;
  7. fit = locfit(age,deaths,'weights',n,'family','binomial','alpha',0.5);
  8. figure('Name','fig4_3a: Residual plots for local likelihood');
  9. plot(age,residuals(fit,'dev'),'.-');
  10. xlabel('Age');
  11. ylabel('Residual');
  12. title('Deviance Residuals');
  13. hold on;
  14. plot([min(age) max(age)],[0 0],':');
  15. hold off;
  16. figure('Name','fig4_3b: Residual plots for local likelihood');
  17. plot(age,residuals(fit,'pear'),'.-');
  18. xlabel('Age');
  19. ylabel('Residual');
  20. title('Pearson Residuals');
  21. hold on;
  22. plot([min(age) max(age)],[0 0],':');
  23. hold off;
  24. figure('Name','fig4_3c: Residual plots for local likelihood');
  25. plot(age,residuals(fit,'raw'),'.-');
  26. xlabel('Age');
  27. ylabel('Residual');
  28. title('Raw (response) Residuals');
  29. hold on;
  30. plot([min(age) max(age)],[0 0],':');
  31. hold off;
  32. figure('Name','fig4_3d: Residual plots for local likelihood');
  33. plot(age,residuals(fit,'ldot'),'.-');
  34. xlabel('Age');
  35. ylabel('Residual');
  36. title('ldot Residuals');
  37. hold on;
  38. plot([min(age) max(age)],[0 0],':');
  39. hold off;