[R] a pickle (solved first part now need r's from data)
John Christie
jc at or.psychology.dal.ca
Fri Aug 22 14:18:15 CEST 2003
On Friday, August 22, 2003, at 01:44 AM, John Christie wrote:
> I predicted that y would increase as x increased. However, I only
> made the prediction on the ranks of the scores. The ranks don't
> correlate with predicted. And, I don't think a regression on the
> ranks is warranted. However, the actual scores do yield a significant
> slope for b, and a significant R^2 using a linear regression (y is the
> value and x is the predicted rank). What should my argument be here?
> Should I have endorsed using the actual scores instead of ranks to
> begin for some reason that doesn't have anything to do with my current
> result? :)
OK, now I realize that I should probably not have been correlating
ranks in the first place because my real data may have had a
non-linear, but still steadily increasing, slope. The ranks would tend
to increase variance where the slope was low and ruined my chance of
finding an effect.
> Oh, on another note, I can use rcorr to get the Spearman correlations,
> but I'd like to be able to just add
> the ranks as a column. I was going to just use order and add a simple
> factor. But, that doesn't deal with ties correctly.
still don't have these yet.
> And, I also wanted to analyze correlations subject by subject and
> compare my two groups. However, there doesn't seem to be a good way
> to get this. I tried using "by" with "cor". However, this requires
> binding x and y which causes cor to return a matrix (if you could pass
> it x and y separate it would just return a number).
>
> given
>
> data frame s
> x y subj
> 4 7 harry
> 5 1 harry
> 6 9 harry
> 2 4 steve
> 3 7 steve
> ...
>
> i'd like to be able to produce
>
> r subj
> .12 harry
> .52 steve
> ...
>
> any tips?
More information about the R-help
mailing list