R 2.8.1
windows XP

I am trying to learn how to use the boot function to perform a bootstrap of a 
regression. I have written a short trial program, shown below. Clearly I have 
done something wrong as the output of each of the 100 bootstrap values for the 
regression are exactly the same - there does not appear to be any bootstrap 
respampling!. What have I done wrong?


# Define function to be run. Function will return
# beta coefficeint for x.
fitter<-function(d)
{
  fit1<-lm(y~x,data=d)
  print(names(fit1))
  print(summary(fit1))
  summary(fit1)$coefficients[2,1]
}

# Define dataframe
x<-1:10
y<-x+rnorm(10)
d<-data.frame(x,y)


#Run boot strap
boot(d,fitter,R=100,sim="parametric")



John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to