Have you seen the lm() function? I think it does what you are talking
about, but the vagueries of your statement make it hard for me to give
a concrete answer. It does worry me to think of you having one
function to do all your regressions analysis ever for any problem
whatsoever....
Michael
On Mon, Oct 31, 2011 at 8:13 AM, flokke <flokke at live.de>
wrote:> Dear all,
> I have a small question.
> I would like to write a function for a regression analysis that an be
> applied to every dataset.
> Now my problem is that I do not know what I have to implement then as input
> for the function
>
> mytest <- function (x,y) {
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?beta <- solve(t(x)%*%x%*%t(x)%*%y
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(....)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
>
> would not make any sense, because then you could only use a dataset with y
> and one predictor,
> but I just dont know how to do this in another way.
>
> Has someone any idea?
>
> Thanks a lot!
> Cheers, Maria
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Function-input-for-regression-analysis-tp3955611p3955611.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>