[R] Identify command in R
Hi all, In using the identify command, I get the following message plot(hatvalues(scireg3)) abline(h=.0154,lty=2) # plots a reference line at (k + 1)/n identify(1:1165, hatvalues(scireg3),row.names(sciach)) Error in xy.coords(x, y) : 'x' and 'y' lengths differ which doesn't allow me to see the observation number when I scroll over with the mouse. What exactly is this problem and is there a way to override it? Thanks in advance. -- === David Kaplan, Ph.D. Professor Department of Educational Psychology University of Wisconsin - Madison Educational Sciences, Room, 1061 1025 W. Johnson Street Madison, WI 53706 email: [EMAIL PROTECTED] homepage: http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html Phone: 608-262-0836 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identify command in R
2008/11/20 David Kaplan [EMAIL PROTECTED]: Hi all, In using the identify command, I get the following message plot(hatvalues(scireg3)) abline(h=.0154,lty=2) # plots a reference line at (k + 1)/n identify(1:1165, hatvalues(scireg3),row.names(sciach)) Error in xy.coords(x, y) : 'x' and 'y' lengths differ which doesn't allow me to see the observation number when I scroll over with the mouse. What exactly is this problem and is there a way to override it? I'll have a wild guess at this and say maybe its a possibility that the lengths of x and y differ. We don't know what scireg3 and sciach are. Or what hatvalues does. Check the lengths of the things you are passing to identify(). You are probably doing something like this: plot(1:10,1:10) identify(1:10,1:9,letters[1:10]) oops. change the 9 to a 10 and it works. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identify command in R
On 21/11/2008, at 9:19 AM, David Kaplan wrote: Hi all, In using the identify command, I get the following message plot(hatvalues(scireg3)) abline(h=.0154,lty=2) # plots a reference line at (k + 1)/n identify(1:1165, hatvalues(scireg3),row.names(sciach)) Error in xy.coords(x, y) : 'x' and 'y' lengths differ which doesn't allow me to see the observation number when I scroll over with the mouse. What exactly is this problem and is there a way to override it? The problem is presumably exactly what it says: 'x' and 'y' lengths differ! cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identify command in R]
Let me try to be more specific. The x y coordinates are different because of NAs in the dataset. In this analysis, a set of hat values (a measure of influence in regression) is given for each observation. On the basis of the regression that was run to get these hat values, the sample size was 1164 (one removed due to NA). The length of the data set is 1165. If I remove the NA from the data set, I can get identify to run. What I would like to know is if there is a way to get identify to ignore the NAs? Thanks in advance, -- === David Kaplan, Ph.D. Professor Department of Educational Psychology University of Wisconsin - Madison Educational Sciences, Room, 1061 1025 W. Johnson Street Madison, WI 53706 email: [EMAIL PROTECTED] homepage: http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html Phone: 608-262-0836 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identify command in R]
2008/11/20 David Kaplan [EMAIL PROTECTED]: Let me try to be more specific. The x y coordinates are different because of NAs in the dataset. In this analysis, a set of hat values (a measure of influence in regression) is given for each observation. On the basis of the regression that was run to get these hat values, the sample size was 1164 (one removed due to NA). The length of the data set is 1165. If I remove the NA from the data set, I can get identify to run. What I would like to know is if there is a way to get identify to ignore the NAs? Still not clear. Your failing example was: identify(1:1165, hatvalues(scireg3),row.names(sciach)) So are you saying that hatvalues(scireg3) is of length 1164? What you really want is for hatvalues to return NA in the places where you have missing data. identify is quite happy with NA values - try: x=1:10 y=runif(10);y[5]=NA plot(x,y) identify(x,y) If you can't change hatvalues to do this, then you'll just have to remove the corresponding values of 1:1165 so that it is of length 1164. So something like: okdata = !is.na(dataset) plot((1:1165)[okdata],hatvalues(dataset)) Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identify command in R]
Reading in between the lines a little, maybe you want lm(..., na.action = na.exclude) That should return missing values for the influence statistics when the predictor or responses is missing in the input. Hadley On Thu, Nov 20, 2008 at 4:19 PM, David Kaplan [EMAIL PROTECTED] wrote: Let me try to be more specific. The x y coordinates are different because of NAs in the dataset. In this analysis, a set of hat values (a measure of influence in regression) is given for each observation. On the basis of the regression that was run to get these hat values, the sample size was 1164 (one removed due to NA). The length of the data set is 1165. If I remove the NA from the data set, I can get identify to run. What I would like to know is if there is a way to get identify to ignore the NAs? Thanks in advance, -- === David Kaplan, Ph.D. Professor Department of Educational Psychology University of Wisconsin - Madison Educational Sciences, Room, 1061 1025 W. Johnson Street Madison, WI 53706 email: [EMAIL PROTECTED] homepage: http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html Phone: 608-262-0836 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.