سؤال

I've plot this graphic to identify graphically high-leverage points in my linear model. enter image description here

Given the variable "NOMBRES" of the data set which my model uses, I've tried to plot all the points of my graphic but it gets illegible. Here's the code I ran:

> plot(hatvalues(tmodel),residuals(tmodel))
> text(hatvalues(tmodel),residuals(tmodel),labels=DSET$NOMBRES)

So I would like to plot just the points with leverage(hat value) above 0.05 using the label "DSET$NOMBRES".

هل كانت مفيدة؟

المحلول

Identify high-leverage points according to your definition:

hlev <- which(hatvalues(tmodel)>0.05)

Add numeric labels to the graph:

text(hatvalues(tmodel)[hlev], residuals(tmodel)[hlev], 
   labels=DSET$NOMBRES[hlev])
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top