Thanks.
So with kid.weights I will have (see below) - or is my example use of quantreg
wrong?
"""
#growth_chart_create.R
library(UsingR)
library(quantreg)
lbs_to_kg<-1/2.2046
inch_to_cm<-2.54
data(kid.weights)
data_kids<-kid.weights
data_kids$weight_kg<-kid.weights$weight*lbs_to_kg
data_kids$length_cm<-kid.weights$height*inch_to_cm
colnames(data_kids)<-c('AGEMOS','WEIGHT_OLD','HEIGHT_OLD','SEX','WEIGHT','HEIGHT')
Dat<-NULL
Dat_temp <- subset(data_kids,SEX=='F')
Dat$x <- Dat_temp$WEIGHT
Dat$y <- Dat_temp$AGEMOS
antal<-length(data_kids$AGEMOS)
plot(Dat,xlab='Age (months)',ylab='Weight (kg)')
# fit first a nonlinear least-square regression
Dat.nls <- nls(y ~ SSlogis(x, Asym, mid, scal), data=Dat); #Dat.nls
lines(1:antal, predict(Dat.nls, newdata=list(x=1:antal)), col=1)
# then fit the median using nlrq
Dat.nlrq <- nlrq(y ~ SSlogis(x, Asym, mid, scal), data=Dat, tau=0.5, trace=TRUE)
lines(1:antal, predict(Dat.nlrq, newdata=list(x=1:antal)), col=2)
# the 1st and 3rd quartiles regressions
Dat.nlrq <- nlrq(y ~ SSlogis(x, Asym, mid, scal), data=Dat, tau=0.25, trace=TRUE)
lines(1:antal, predict(Dat.nlrq, newdata=list(x=1:antal)), col=3)
Dat.nlrq <- nlrq(y ~ SSlogis(x, Asym, mid, scal), data=Dat, tau=0.75, trace=TRUE)
lines(1:antal, predict(Dat.nlrq, newdata=list(x=1:antal)), col=3)
# and finally "external envelopes" holding 95 percent of the data
Dat.nlrq <- nlrq(y ~ SSlogis(x, Asym, mid, scal), data=Dat, tau=0.025, trace=TRUE)
lines(1:antal, predict(Dat.nlrq, newdata=list(x=1:antal)), col=4)
Dat.nlrq <- nlrq(y ~ SSlogis(x, Asym, mid, scal), data=Dat, tau=0.975, trace=TRUE)
lines(1:antal, predict(Dat.nlrq, newdata=list(x=1:antal)), col=4)
leg <- c("least squares","median (0.5)","quartiles (0.25/0.75)",".95 band
(0.025/0.975)")
legend(30, 60, legend=leg, lty=1, col=1:4)
"""
On Thu, 8 Nov 2007 10:44:56 -0600, roger koenker wrote
The lmsqreg package is by Vince Carey and is available from his
website. There is an independent package with fortran routines from
Tim Cole. Both packages implement the LMS method of Cole and Green.
You might also want to consider alternative methods: an approach
based on nonparametric quantile regression is described in:
http://www.ncbi.nlm.nih.gov/sites/entrez?
cmd=Retrieve&db=PubMed&list_uids=16143984&dopt=AbstractPlus
Some comparison with the LMS method are reported there.
url: www.econ.uiuc.edu/~roger Roger Koenker
email rkoenker at uiuc.edu Department of Economics
vox: 217-333-4558 University of Illinois
fax: 217-244-6678 Champaign, IL 61820
On Nov 8, 2007, at 10:16 AM, Niels Steen Krogh wrote:
We are constructing growth charts (age/weight and age/length) for
children
with diagnosis that impacts weight/length.
But we we don't know how to use R for producing growth charts.
We are collection data of Age, Weight and Length.
The data are used to produce diagnosis-specific Growth charts (like
the CDC
Growth Charts:
http://www.cdc.gov/nchs/data/nhanes/growthcharts/set1clinical/
cj41l017.pdf)
Data-example is in the UsingR package as data(kid.weights).
In the CDC-papers a LMS approch is described. Cole has programmed the
methology (I guess) in a <R 2.0.0 package called lmsqreg:
"""
library(lmsqreg)
Error in library(lmsqreg) :
lmsqreg' is not a valid package -- installed < 2.0.0?)
"""
Where to go forward in R.
Thanks for any "hints".
We are using R2.6.0 on win/linux
/Niels
Niels Steen Krogh
Konsulent
ZiteLab ApS
Mail: ---------- nielssteenkrogh at zitelab.dk
Telefon: ------- +45 38 88 86 13
Mobil: --------- +45 22 67 37 38
Adresse: ------- ZiteLab ApS
---------------- Solsortvej 44
---------------- dk - 2000 F.
--- og ---
---------------- ZiteLab ApS
---------------- Refshalevej 110a
---------------- dk - 1432 k?benhavn k
Web: ----------- www.zitelab.dk
CVR: ----------- 29178364
Bank: ---------- Sparbank Vest
Ejer: ---------- ZSRK Group Holding
Niels Steen Krogh
Konsulent
ZiteLab ApS
Mail: ---------- nielssteenkrogh at zitelab.dk
Telefon: ------- +45 38 88 86 13
Mobil: --------- +45 22 67 37 38
Adresse: ------- ZiteLab ApS
---------------- Solsortvej 44
---------------- dk - 2000 F.
--- og ---
---------------- ZiteLab ApS
---------------- Refshalevej 110a
---------------- dk - 1432 k?benhavn k
Web: ----------- www.zitelab.dk
CVR: ----------- 29178364
Bank: ---------- Sparbank Vest
Ejer: ---------- ZSRK Group Holding
On Thu, 8 Nov 2007 10:44:56 -0600, roger koenker wrote
The lmsqreg package is by Vince Carey and is available from his
website. There is an independent package with fortran routines from
Tim Cole. Both packages implement the LMS method of Cole and Green.
You might also want to consider alternative methods: an approach
based on nonparametric quantile regression is described in:
http://www.ncbi.nlm.nih.gov/sites/entrez?
cmd=Retrieve&db=PubMed&list_uids=16143984&dopt=AbstractPlus
Some comparison with the LMS method are reported there.
url: www.econ.uiuc.edu/~roger Roger Koenker
email rkoenker at uiuc.edu Department of Economics
vox: 217-333-4558 University of Illinois
fax: 217-244-6678 Champaign, IL 61820
On Nov 8, 2007, at 10:16 AM, Niels Steen Krogh wrote:
We are constructing growth charts (age/weight and age/length) for
children
with diagnosis that impacts weight/length.
But we we don't know how to use R for producing growth charts.
We are collection data of Age, Weight and Length.
The data are used to produce diagnosis-specific Growth charts (like
the CDC
Growth Charts:
http://www.cdc.gov/nchs/data/nhanes/growthcharts/set1clinical/
cj41l017.pdf)
Data-example is in the UsingR package as data(kid.weights).
In the CDC-papers a LMS approch is described. Cole has programmed the
methology (I guess) in a <R 2.0.0 package called lmsqreg:
"""
library(lmsqreg)
Error in library(lmsqreg) :
lmsqreg' is not a valid package -- installed < 2.0.0?)
"""
Where to go forward in R.
Thanks for any "hints".
We are using R2.6.0 on win/linux
/Niels
Niels Steen Krogh
Konsulent
ZiteLab ApS
Mail: ---------- nielssteenkrogh at zitelab.dk
Telefon: ------- +45 38 88 86 13
Mobil: --------- +45 22 67 37 38
Adresse: ------- ZiteLab ApS
---------------- Solsortvej 44
---------------- dk - 2000 F.
--- og ---
---------------- ZiteLab ApS
---------------- Refshalevej 110a
---------------- dk - 1432 k?benhavn k
Web: ----------- www.zitelab.dk
CVR: ----------- 29178364
Bank: ---------- Sparbank Vest
Ejer: ---------- ZSRK Group Holding