Search the web
Sign In
New User? Sign Up
omatrix
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Linear Algebra   Message List  
Reply | Forward Message #428 of 454 |
Trying to replicate the example from wikipedia for linear regression
using the following O-Matrix script
##### Code Start ###################################
height = {1.47, 1.5, 1.52, 1.55, 1.57, 1.60, 1.63, 1.65, 1.68, 1.7,
1.73, 1.75, 1.78, 1.8, 1.83}
weight = {52.21, 53.12, 54.48, 55.84, 57.2, 58.57, 59.93, 61.29,
63.11, 64.47, 66.28, 68.1, 69.92, 72.19, 74.46}

X = [ones(rowdim(height),1), height, height^2]

s = inv(X'*X)
bhat = X\weight # Backslash division
bhat2 = s*X'*weight # As shown
http://en.wikipedia.org/wiki/Linear_regression

print bhat
print bhat2
##### Code end #####################################
# O-Matrix responds
##### Command window output begin ##################
{
128.807
-143.155
61.9582
}

{
132.617
-147.417
63.0986
}
##### Command window output end ##################

Why if they are both implementations of linear regression (although
different methods) are the results so different?

Cheers,

Kurt




Thu Apr 24, 2008 5:42 pm

kurtforrester
Offline Offline
Send Email Send Email

Forward
Message #428 of 454 |
Expand Messages Author Sort by Date

Trying to replicate the example from wikipedia for linear regression using the following O-Matrix script ##### Code Start ################################### ...
kurtforrester
Offline Send Email
Apr 24, 2008
5:42 pm

Kurt, Your solutions bhat, i.e. beta hat in the wiki article I believe are within the stated confidence intervals? I believe that the stated bhat values in ...
Harmonic Software
beau_paisley
Offline Send Email
Apr 27, 2008
12:12 am

Beau, Thanks for the response. Both methods are supposed to be minimising the sum of squared error (SSE) sum(observed_i - predicted_i)^2. Therefore comparing...
kurtforrester
Offline Send Email
Apr 28, 2008
10:30 am

Beau, Another follow-up about the least squares regression issue. Quoting from the matlab website. "Use the MATLAB® backslash operator (mldivide) to solve a...
kurtforrester
Offline Send Email
Apr 28, 2008
2:12 pm

One final piece of relevant information that other users may find useful: http://www.mathworks.com/support/solutions/files/s36851/regstats_details.html It...
kurtforrester
Offline Send Email
Apr 28, 2008
3:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help