Giam Xingli
2009-Apr-06 03:15 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Hi there, 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. Many thanks in advance! Best regards, Xingli
Dieter Menne
2009-Apr-06 06:13 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
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
rkevinburton at charter.net
2009-Apr-06 19:39 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Is the output of residuals() the studentized residuals or just the residuals? ---- Dieter Menne <dieter.menne at 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 at 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.
Dieter Menne
2009-Apr-07 10:22 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
<rkevinburton <at> charter.net> writes:> Is the output of residuals() the studentized residuals or just the residuals?As the name says, studentizing is left as an easy student exercise. Destudentizing is more difficult and usually called professorizing. Dieter
Giam Xingli
2009-Apr-07 10:46 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Hi Kevin, I need the studentized residuals. In linear models, they can be computed by using rstudent( ) function, but there seems to be no such function for nls( ) output. Alternatively, it'll be helpful if I could compute the leverage values. Best, Xingli
Dieter Menne
2009-Apr-07 17:23 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
Giam Xingli <giam <at> nus.edu.sg> writes:> I need the studentized residuals. In linear models, they can be computed byusing rstudent( ) function, but> there seems to be no such function for nls( ) output.I darkly remember having read this message before. Homework still not done? http://markmail.org/message/l7ibt3b6jfu4cj2x Check Wikipedia on the definition of studentized. Dieter
Giam Xingli
2009-Apr-09 00:19 UTC
[R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()]
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: <rkevinburton at charter.net> Subject: Re: [R] Need help in calculating studentized residuals/leverage values of non-linear model [nls()] To: Dieter Menne <dieter.menne at menne-biomed.de>, r-help at stat.math.ethz.ch Message-ID: <20090406153907.97VPO.402395.root at mp16> Content-Type: text/plain; charset=utf-8 Is the output of residuals() the studentized residuals or just the residuals? ---- Dieter Menne <dieter.menne at 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 at 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.