[R] SPSS -> R
Michael Dewey
info at aghmed.fsnet.co.uk
Wed Nov 30 12:49:23 CET 2011
At 16:41 27/11/2011, Kristi Shoemaker wrote:
>Hi John,
>
>Your assumptions are correct and those examples were very helpful, thanks!
>
>I think I'm almost there, but I'm screwing up something with the
>within-subjects factor (the example has two, I only have one). See
>below. Why am I not seeing my within-subjects factors in the ANOVA report?
I am by no means an expert in this but my reading of the
documentation suggests that the idata and idesign parameters are for
multivariate models and that is not what you specified.
> > Dat2
> Subj Age Sex Time HippV
>1 s01 32.9 1 0w 6.50098
>2 s01 32.9 1 6w 6.91793
>3 s02 35.1 0 0w 7.32480
>4 s02 35.1 0 6w 7.56012
>5 s03 34.4 0 0w 6.51385
>6 s03 34.4 0 6w 6.56875
>9 s05 39.9 1 0w 6.92855
>10 s05 39.9 1 6w 6.94926
>11 s06 29.5 1 0w 6.99383
>12 s06 29.5 1 6w 7.10568
>13 s07 45.9 1 0w 6.94380
>14 s07 45.9 1 6w 7.08190
>15 s08 20.3 1 0w 7.76881
>16 s08 20.3 1 6w 7.72725
>17 s09 26.9 0 0w 5.37566
>18 s09 26.9 0 6w 5.74887
>21 s11 22.0 0 0w 7.12992
>22 s11 22.0 0 6w 7.16237
>23 s12 31.0 1 0w 6.70629
>24 s12 31.0 1 6w 6.80872
>25 s13 50.1 1 0w 7.22649
>26 s13 50.1 1 6w 7.58900
>27 s14 22.2 0 0w 5.97577
>28 s14 22.2 0 6w 5.80801
>29 s16 20.4 1 0w 7.99554
>30 s16 20.4 1 6w 8.09260
>31 s20 24.0 0 0w 7.01014
>32 s20 24.0 0 6w 6.87821
>33 s21 32.4 0 0w 5.90883
>34 s21 32.4 0 6w 5.95392
>37 s24 22.2 0 0w 6.15474
>38 s24 22.2 0 6w 6.00906
>41 s27 22.2 1 0w 7.88765
>42 s27 22.2 1 6w 7.76038
>49 s35 24.3 0 0w 6.05998
>50 s35 24.3 0 6w 6.07399
>51 s36 23.5 0 0w 7.83182
>52 s36 23.5 0 6w 7.60268
>53 s38 59.7 1 0w 7.39672
>54 s38 59.7 1 6w 6.98291
>55 s39 40.5 0 0w 7.31330
>56 s39 40.5 0 6w 7.50559
>57 s40 24.2 1 0w 8.54958
>58 s40 24.2 1 6w 8.65016
>59 s41 23.6 1 0w 7.76049
>60 s41 23.6 1 6w 7.58946
>61 s42 53.3 0 0w 7.03388
>62 s42 53.3 0 6w 7.48384
>63 s43 34.4 0 0w 6.86967
>64 s43 34.4 0 6w 6.81076
>65 s44 44.8 0 0w 7.33779
>66 s44 44.8 0 6w 7.86175
>67 s45 40.2 1 0w 6.55963
>68 s45 40.2 1 6w 6.52577
>71 s47 26.5 0 0w 7.09418
>72 s47 26.5 0 6w 6.92850
>73 s48 22.7 0 0w 6.77078
>74 s48 22.7 0 6w 6.67289
>75 s50 36.1 1 0w 7.47208
>76 s50 36.1 1 6w 7.55876
> > library(car)
>Loading required package: MASS
>Loading required package: nnet
>Loading required package: survival
>Loading required package: splines
> > timepoints <- factor(c("0w", "6w"),
>+ levels=c("0w","6w"))
> > idata=data.frame(timepoints)
> > mod.ok <- lm(HippV ~ Age*Sex,data=Dat2)
> > (av.ok <- Anova(mod.ok, idata=idata, idesign=~timepoints))
>Anova Table (Type II tests)
>
>Response: HippV
> Sum Sq Df F value Pr(>F)
>Age 0.0234 1 0.071 0.7909202
>Sex 5.3082 1 16.128 0.0001781 ***
>Age:Sex 4.7772 1 14.514 0.0003478 ***
>Residuals 18.4314 56
>---
>Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >
>
>
>
>________________________________
> From: John Fox <jfox at mcmaster.ca>
>
>Cc: r-help at r-project.org
>Sent: Saturday, November 26, 2011 7:19 PM
>Subject: RE: [R] SPSS -> R
>
>Dear Kristi,
>
>I assume that this is a repeated-measures ANOVA with one within-subjects
>factor (Time) and two between-subjects factors (Age and Sex, which are
>crossed). If Age is numeric, and not a factor, then the "type-III" tests
>that you requested don't test sensible hypotheses. In any event, if my guess
>is right about the design, then you can use the Anova() function in the car
>package for an equivalent analysis. See the repeated-measures example in
>?Anova (for the O'Brien and Kaiser data).
>
>You've already had an answer to the more general question.
>
>I hope this helps,
>John
>
>--------------------------------
>John Fox
>Senator William McMaster
> Professor of Social Statistics
>Department of Sociology
>McMaster University
>Hamilton, Ontario, Canada
>http://socserv.mcmaster.ca/jfox
>
>
>
>
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> > project.org] On Behalf Of Kristi Shoemaker
> > Sent: November-26-11 11:08 AM
> > To: r-help at r-project.org
> > Subject: [R] SPSS -> R
> >
> > I'm an SPSS user trying to make the transition to R.
> >
> > Can someone help me translate the following SPSS code into R?:
> >
> >
> > GLM Total_tp1 Total_tp2 WITH Age Sex
> > /WSFACTOR=Time 2 Repeated
> > /METHOD=SSTYPE(3)
> > /CRITERIA=ALPHA(.05)
> > /WSDESIGN= Time
> > /DESIGN= Age Sex Age*Sex.
> >
> > Also. can anyone recommend any resources to help SPSS users learn to
> > things in R?
> >
> > Thanks,
> > -kristi
> >
> > [[alternative HTML version deleted]]
> [[alternative HTML version deleted]]
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html
More information about the R-help
mailing list