[R] interpolation in matrix

Mark M. Span span at psy.uva.nl
Fri Apr 6 09:50:47 CEST 2001


How would you proceed with the following problem:

I have an data frame containing a table relating raw scores on an iq test to
'decile-like' scores.

data<-data.frame(age   =c( 8,  9, 10, 11, 12, 13, 25, 30, 35, 40, 45, 50,
55, 60, 65, 70),
                         pers90=c(33, 39, 43, 47, 50, 54, 54, 52, 50, 49,
47, 46, 43, 42, 39, 37),
                         perc75=c(27, 31, 37, 42, 46, 49, 49, 47, 46, 44,
42, 40, 37, 34, 31, 30),
                         perc50=c(21, 25, 29, 34, 39, 44, 44, 42, 39, 37,
34, 31, 29, 27, 25, 22),
                         pers25=c(16, 19, 22, 27, 30, 37, 37, 33, 30, 29,
27, 25, 22, 21, 19, 16),
                         pers10=c(12, 15, 18, 21, 25, 30, 30, 26, 25, 23,
21, 20, 18, 16, 15, 13)
                         )

For each age the percXX field hold the score for the subject wich is a lower
bound for the raw score, to place the subject in this percentile. I would
like to be able to interpolate both age and percentile, so I can use a
function like

perc<-getPerc(age, raw)

which would yield a score between 0 and 100

What would be the way to go?

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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