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.
Function input for regression analysis
5 messages · R. Michael Weylandt, flokke, Bert Gunter
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.
I know the lm() function, but I'd like to make my 'own' regression analysis by using matrix algebra. Thats why I wrote the function, but I dont know what values to pick to make it suitable for every dataset. If I pick a statistical model like lm(y~x) as input, the function would not know what objects it had to use for the matrix algebra. -- View this message in context: http://r.789695.n4.nabble.com/Function-input-for-regression-analysis-tp3955611p3956240.html Sent from the R help mailing list archive at Nabble.com.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111031/becdf1dc/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111031/e9d2874b/attachment.pl>