Re: [R] fitting non linear data

About this list Date view Thread view Subject view Author view Attachment view

From: Frank E Harrell Jr (fharrell@virginia.edu)
Date: Wed 22 May 2002 - 23:16:34 EST


Message-id: <20020522091634.783c94c9.fharrell@virginia.edu>



                          [manually approved because of binary attachment]

To factor in model uncertainty you might bootstrap a semiparametric regression. The Hmisc library areg.boot function, using the default method of avas, develops a semiparametric additive model and uses the bootstrap for confidence bands for the transformations on predictor and response variables. As an example I tried

f <- areg.boot(I(y) ~ x) # don't transform y, optimally transform x
# The default y ~ x shows a lot of uncertainty in transformation of y for
# large y

f

avas Additive Regression Model

areg.boot(x = I(y) ~ x)

n= 8 p= 1

Apparent R2 on transformed Y scale: 0.886
Bootstrap validated R2 : 0.683

Coefficients of standardized transformations:

    Intercept x
-1.503799e-16 1.087857e+00

summary(f)

summary.areg.boot(obj = f)

Estimates based on 100 resamples

Values to which predictors are set when estimating
effects of other predictors:

I(y) x
 5.5 5.5

Estimates of differences of effects on Median Y (from first X value),
and bootstrap standard errors of these differences.
Settings for X are shown as row headings.

Predictor: x
      
x Differences S.E Lower 0.95 Upper 0.95 Z Pr(|Z|)
  3.75 0.000000 NA NA NA NA NA
  5.50 -4.614057 1.268541 -7.100353 -2.127762 -3.637294 0.0002755177
  7.25 -7.144868 2.030195 -11.123978 -3.165758 -3.519300 0.0004326864

plot(f) # see attached

I had to fix a small bug in the function to make this work.
In the plot, confidence bands are in black, individual bootstrap estimates are in red.

Frank Harrell

On Wed, 22 May 2002 12:21:45 +0200
gregory lefebvre <greggory.lefebvre@univ-rouen.fr> wrote:

> Hye every one,
>
> My question will certainly seem stupid as I am quite a beginner in R.
>
> I would like to trace a curve which fits these two vectors:
> x<-c( 2,3,4,5,6,7,8,10 )
> y<-c( 20, 12, 8, 6, 5, 4.5, 4, 3.8)
>
> It seems to follow a non linear model.
>
> Could anyone help me because I could'nt find the answer I am looking for
> in the FAQs.
>
> In advance thank you for your time.
>
> G. Lefebvre
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat



About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:17 EST