Hi Dieter, Yes, I understand the definition of studentized residuals and I also know that studentizing the residuals is an easy exercise. However, I need the hat ('leverage')-values to studentize the residuals. I tried to use hatvalues() to obtain the leverage values but while it works on glm and lm objects, it doesn't work on nls() objects.
I also tried to do this: X <- model.matrix(model) # where model is an nls() object H <- X %*% solve( t(X) %*% X ) %*% t(X) hatvalues <- diag(H) But model.matrix didn't work either. That is why I posted the question of getting the studentized residuals or the leverage values of nls() objects. I hope you don't misunderstand me, I'm sorry the original post came across as a 'homework' question. Many thanks, Xingli (P.S. I saw your reply on CRAN. However I didn't get the daily digest, so I am replying to your previous post. Sorry about that!) ------------------------------ Message: 72 Date: Mon, 6 Apr 2009 12:39:07 -0700 From: <rkevinbur...@charter.net> Subject: Re: [R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()] To: Dieter Menne <dieter.me...@menne-biomed.de>, r-h...@stat.math.ethz.ch Message-ID: <20090406153907.97vpo.402395.r...@mp16> Content-Type: text/plain; charset=utf-8 Is the output of residuals() the studentized residuals or just the residuals? ---- Dieter Menne <dieter.me...@menne-biomed.de> wrote: > Giam Xingli <giam <at> nus.edu.sg> writes: > > > I hope I can get advice regarding the calculation of leverage values or > > studentized residual values of a non-linear regression model. It seems > > like > > rstudent() does not work on a nls object. > > residuals() should work for nls. > > Dieter > > ______________________________________________ > 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.
______________________________________________ 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.