The first program generates an error message and does not execute the 
regression of y on x.


        x<-1:10;
        y<-rnorm(10) + x;

        prac <- function( model, wghts ){ lm(model, weights = wghts) }

        prac(model = y~x, wghts = rep(1, 10))



But the next program works:

        x<-1:10;
        y<-rnorm(10) + x;

        prac <- function( y, x, wghts ){ lm(y~x, weights = wghts) }

        prac(y=y, x=x, wghts = rep(1, 10))


I would be grateful for an explanation of why the first program does not 
work. It seems to me like they should both give the same result.





Joe Boyer
Statistical Sciences 
Renaissance Bldg 510, 3233-D
Mail Stop RN0320
8-275-3661
cell: (610) 209-8531
        [[alternative HTML version deleted]]

______________________________________________
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