[R] lm Help!!

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Apr 12 11:23:09 CEST 2000


Kenneth Cabrera <krcabrer at epm.net.co> writes:

> Hi, everybody!!
>
> How can I calculate the Type III ss, as defined by SAS, for a linear regresion?

Like this:

> drop1(lm1, test="F")
Single term deletions

Model:
Fertility ~ Agriculture + Examination + Education + Catholic +
    Infant.Mortality
                 Df Sum of Sq    RSS    AIC F value     Pr(F)
<none>                        2105.0  190.7
Agriculture       1     307.7 2412.8  195.1  5.9934  0.018727 *
Examination       1      53.0 2158.1  189.9  1.0328  0.315462
Education         1    1162.6 3267.6  209.4 22.6432 2.431e-05 ***
Catholic          1     447.7 2552.8  197.8  8.7200  0.005190 **
Infant.Mortality  1     408.8 2513.8  197.0  7.9612  0.007336 **
---
Signif. codes:  0  `***'  0.001  `**'  0.01  `*'  0.05  `.'  0.1  ` '  1


>
> How can you use apply with a function that have several parameters like "plot"?

Depends on what you want to do. There's nothing wrong with

ma<-matrix(c(1, 2, 3, 4, 1, 6, 7, 8),nrow=2)
par(mfrow=c(2,1))
apply(ma,1,plot)

if you want to add fixed arguments, just plug them in as
...-arguments:

apply(ma,1,plot,x=4:1,type='b')

Sometimes things get too sticky and you have to define a function of 1
arg:

apply(ma,1,function(y) plot(4:1,y,type='b'))

--
   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list