Re: [R] Question on partial effect

From: Guo Wei-Wei <wwguocn_at_gmail.com>
Date: Wed 12 Jul 2006 - 02:51:17 EST

Thank you, Gavin. I think that might be what I need. But I'm a little bit wandering what's the scale of resid(mod). Is it scale(dist)/scale(speed), for example kilometer / (kilometer per hour)? or something else?

Thank you very much!
Wei-Wei

2006/7/12, Gavin Simpson <gavin.simpson@ucl.ac.uk>:
> On Tue, 2006-07-11 at 23:51 +0800, Guo Wei-Wei wrote:
> > Dear all,
> >
> > I don't know what's my question is called. I have a performance
> > variable A, such as sales. And I have another variable B, let's say
> > establish time of firm. I want to create the third variable that is
> > sales without the effect of establish time. Maybe it can be called
> > partial effect problem. I'm not sure.
> >
> > Does anyone have any suggestion? Thank you in advance!
> >
> > All the best,
> > Wei-Wei
>
> Do you mean?
>
> ## dummy data
> A <- rnorm(100)
> B <- rnorm(100)
> C <- resid(lm(A ~ B))
>
> C now contains the residual variation in A after fitting B.
>
> e.g. with some real data
> ?cars
> data(cars) # not sure this is needed now, I forget
> mod <- lm(dist ~ speed, data = cars)
> summary(mod)
> partial <- resid(mod)
>
> ## check
> mod2 <- lm(dist ~ partial, data = cars)
> summary(mod2)
> ## from the two R^2 form mod1 and mod2 - partial contains dist minus
> ## the effects of speed
> > 0.6511 + 0.3489
> [1] 1
>
> HTH
>
> G
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Gavin Simpson [t] +44 (0)20 7679 0522
> ECRC & ENSIS, UCL Geography, [f] +44 (0)20 7679 0565
> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
> Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/
> London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 12 02:56:39 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 04:18:02 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.