2007/11/6, Antonio P. Ramos <[EMAIL PROTECTED]>:
>
> Does anyone have a "smart" code for performing bi and mult-ivariable
> regression in R by hand? This is suppose to help students without a sound
> knowledge of R to understand what the computer is doing when we write
> lm(x~y).
>
>
Hi,
May be I don't correctly understandood your question. Assuming  yes:

y=matrix(c(2,3,2,2,4,10,12,8,3,14),ncol=1)
x1=matrix(c(1,2,3,4,5,6,6,7,9,9),ncol=1)
x2=matrix(c(1,6,3,2,2,5,9,4,1,7),ncol=1)
X=matrix(c(rep(1,10),x1,x2),ncol=3)
solve(t(X)%*%X)%*%(t(X)%*%y)

-- 
==================
Germano Rossi, Dipartimento di Psicologia
Universita' degli Studi di Milano Bicocca
Piazza dell'Ateneo Nuovo, 1- 20126 Milano - Italy
tel. +39 02 6448 3740    fax:+39 02 6448 3706
Professore associato di Psicometria
Docente di Statistica per la ricerca sociale e di Psicometria

        [[alternative HTML version deleted]]

_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching

Reply via email to