Home » date » 2007 » Dec » 19 » attachments

Multiple Regression

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Wed, 19 Dec 2007 07:16:32 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq.htm/, Retrieved Wed, 19 Dec 2007 15:03:34 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
0.8833 18.33 0 0.87 22.6 0 0.8758 24.9 0 0.8858 24.8 0 0.917 23.8 0 0.9554 25.1 0 0.9922 26 0 0.9778 27.4 0 0.9808 27.3 0 0.9811 24.3 0 1.0014 28.4 0 1.0183 24.4 0 1.0622 30.3 0 1.0773 31.5 0 1.0807 29.8 0 1.0848 25.3 0 1.1582 25.6 1 1.1663 26.7 1 1.1372 27.4 1 1.1139 28.6 1 1.1222 26.3 1 1.1692 28.5 1 1.1702 28.4 1 1.2286 29.4 1 1.2613 30.3 1 1.2646 29.6 1 1.2262 32.1 1 1.1985 32.4 1 1.2007 36.3 1 1.2138 34.6 1 1.2266 36.3 1 1.2176 40.3 1 1.2218 40.4 1 1.249 45.4 1 1.2991 39 1 1.3408 35.7 1 1.3119 40.2 1 1.3014 41.7 1 1.3201 49.1 1 1.2938 49.6 1 1.2694 47 1 1.2165 52 1 1.2037 53.1 1 1.2292 57.8 1 1.2256 57.9 1 1.2015 54.6 1 1.1786 51.3 1 1.1856 52.7 1 1.2103 58.5 1 1.1938 56.6 1 1.202 57.9 1 1.2271 64.4 1 1.277 65.1 1 1.265 64.6 1 1.2684 68.9 1 1.2811 68.8 1 1.2727 59.3 1 1.2611 55 1 1.2881 55.4 1 1.3213 58 1 1.2999 50.8 1 1.3074 54.6 1 1.3242 58.6 1 1.3516 63.6 1 1.3511 64.5 1 1.3419 66.9 1 1.3716 71.9 1 1.3622 68.7 1 1.3896 74.2 1 1.4227 75.8 1
 
Text written by user:
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Dollarkoers[t] = + 0.921040858135407 + 0.00340081831326493Olieprijs[t] + 0.202137970751832Inval_in_IraK_mei2003[t] -0.0137909931864788M1[t] -0.0208217741230416M2[t] -0.027360595681306M3[t] -0.0296249791833293M4[t] -0.0425949410234984M5[t] -0.0493193108869674M6[t] -0.0502845127022556M7[t] -0.0578022704532755M8[t] -0.0491380915295684M9[t] -0.0361345127022555M10[t] -0.0330043764241018M11[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)0.9210408581354070.03304327.87400
Olieprijs0.003400818313264930.0005745.924100
Inval_in_IraK_mei20030.2021379707518320.0218979.231300
M1-0.01379099318647880.03684-0.37440.7095560.354778
M2-0.02082177412304160.036861-0.56490.5744150.287207
M3-0.0273605956813060.036949-0.74050.4620910.231046
M4-0.02962497918332930.037014-0.80040.4268790.213439
M5-0.04259494102349840.036803-1.15740.2520270.126014
M6-0.04931931088696740.036843-1.33860.1860980.093049
M7-0.05028451270225560.036952-1.36080.1790220.089511
M8-0.05780227045327550.037036-1.56070.1242310.062115
M9-0.04913809152956840.036969-1.32920.1891850.094593
M10-0.03613451270225550.036952-0.97790.3323350.166168
M11-0.03300437642410180.038395-0.85960.3936780.196839


Multiple Linear Regression - Regression Statistics
Multiple R0.91626217604825
R-squared0.839536375256675
Adjusted R-squared0.80228589094126
F-TEST (value)22.5375962403061
F-TEST (DF numerator)13
F-TEST (DF denominator)56
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.0607069438626921
Sum Squared Residuals0.206378649856291


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
10.88330.969586864631072-0.0862868646310719
20.870.977077577892152-0.107077577892152
30.87580.978360638454397-0.102560638454397
40.88580.975756173121047-0.0899561731210474
50.9170.959385392967613-0.0423853929676134
60.95540.957082086911389-0.00168208691138883
70.99220.9591776215780390.0330223784219609
80.97780.956421009465590.0213789905344099
90.98080.964745106557970.0160548934420293
100.98110.9675462304454890.0135537695545112
111.00140.984619721808030.0167802781919713
121.01831.004020824979070.0142791750209292
131.06221.010294659840860.051905340159145
141.07731.007344860880210.0699551391197897
151.08070.9950246481893960.0856753518106045
161.08480.977456582277680.10734341772232
171.15821.16764483668332-0.00944483668332232
181.16631.164661366964440.00163863303555519
191.13721.16607673796844-0.0288767379684419
201.11391.16263996219334-0.04873996219334
211.12221.16348225899654-0.0412822589965376
221.16921.18396763811303-0.0147676381130334
231.17021.18675769255986-0.0165576925598607
241.22861.223162887297230.00543711270277254
251.26131.212432630592690.0488673694073131
261.26461.203021276836840.0615787231631612
271.22621.204984501061740.0212154989382632
281.19851.20374036305369-0.00524036305369301
291.20071.20403359263526-0.00333359263525694
301.21381.191527831639240.0222721683607622
311.22661.19634402095650.0302559790435001
321.21761.202429536458540.0151704635414604
331.22181.211433797213570.0103662027864267
341.2491.241441467607210.00755853239278926
351.29911.222806366680470.0762936333195309
361.34081.244588042670800.0962119573292035
371.31191.246100731894010.0657992681059902
381.30141.244171178427340.0572288215726554
391.32011.262798412387240.0573015876127594
401.29381.262234438041850.0315655619581502
411.26941.240422348587190.0289776514128082
421.21651.25070207029005-0.0342020702900477
431.20371.25347776861935-0.0497777686193508
441.22921.26194385694068-0.032743856940676
451.22561.27094811769571-0.0453481176957097
461.20151.27272899608925-0.0712289960892482
471.17861.26463643193363-0.0860364319336276
481.18561.3024019539963-0.116801953996300
491.21031.30833570702676-0.0980357070267583
501.19381.29484337129499-0.101043371294992
511.2021.29272561354397-0.0907256135439722
521.22711.31256654907817-0.0854665490781708
531.2771.30197716005729-0.0249771600572873
541.2651.29355238103719-0.0285523810371859
551.26841.30721069796894-0.0388106979689368
561.28111.29935285838659-0.0182528583865905
571.27271.27570926333428-0.00300926333428065
581.26111.27408932341455-0.0129893234145541
591.28811.278579787018010.00952021298198607
601.32131.320426291056600.000873708943395337
611.29991.282149406014620.0177505939853819
621.30741.288041734668460.0193582653315377
631.32421.295106186363260.0290938136367424
641.35161.309845894427560.041754105572441
651.35111.299936669069330.0511633309306717
661.34191.301374263157700.0405257368423049
671.37161.317413152908730.0541868470912684
681.36221.299012776555260.0631872234447362
691.38961.326381456201930.0632185437980718
701.42271.344826344330460.0778736556695352
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/1uv3a1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/1uv3a1198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/2x2mq1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/2x2mq1198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/3dfh11198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/3dfh11198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/4o4fi1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/4o4fi1198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/57nr61198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/57nr61198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/6whaq1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/6whaq1198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/7i1411198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/7i1411198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/8ch8n1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/8ch8n1198073787.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/94rsv1198073787.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/19/t1198073003x5msm8hvb9nryjq/94rsv1198073787.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = No Linear Trend ;
 
Parameters (R input):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = No Linear Trend ;
 
R code (references can be found in the software module):
library(lattice)
par1 <- as.numeric(par1)
x <- t(y)
k <- length(x[1,])
n <- length(x[,1])
x1 <- cbind(x[,par1], x[,1:k!=par1])
mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
colnames(x1) <- mycolnames #colnames(x)[par1]
x <- x1
if (par3 == 'First Differences'){
x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
for (i in 1:n-1) {
for (j in 1:k) {
x2[i,j] <- x[i+1,j] - x[i,j]
}
}
x <- x2
}
if (par2 == 'Include Monthly Dummies'){
x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
for (i in 1:11){
x2[seq(i,n,12),i] <- 1
}
x <- cbind(x, x2)
}
if (par2 == 'Include Quarterly Dummies'){
x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
for (i in 1:3){
x2[seq(i,n,4),i] <- 1
}
x <- cbind(x, x2)
}
k <- length(x[1,])
if (par3 == 'Linear Trend'){
x <- cbind(x, c(1:n))
colnames(x)[k+1] <- 't'
}
x
k <- length(x[1,])
df <- as.data.frame(x)
(mylm <- lm(df))
(mysum <- summary(mylm))
bitmap(file='test0.png')
plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
points(x[,1]-mysum$resid)
grid()
dev.off()
bitmap(file='test1.png')
plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
grid()
dev.off()
bitmap(file='test2.png')
hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
grid()
dev.off()
bitmap(file='test3.png')
densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test4.png')
qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
grid()
dev.off()
(myerror <- as.ts(mysum$resid))
bitmap(file='test5.png')
dum <- cbind(lag(myerror,k=1),myerror)
dum
dum1 <- dum[2:length(myerror),]
dum1
z <- as.data.frame(dum1)
z
plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
lines(lowess(z))
abline(lm(z))
grid()
dev.off()
bitmap(file='test6.png')
acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
grid()
dev.off()
bitmap(file='test7.png')
pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
grid()
dev.off()
bitmap(file='test8.png')
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(mylm, las = 1, sub='Residual Diagnostics')
par(opar)
dev.off()
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
a<-table.row.end(a)
myeq <- colnames(x)[1]
myeq <- paste(myeq, '[t] = ', sep='')
for (i in 1:k){
if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
if (rownames(mysum$coefficients)[i] != '(Intercept)') {
myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
}
}
myeq <- paste(myeq, ' + e[t]')
a<-table.row.start(a)
a<-table.element(a, myeq)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Variable',header=TRUE)
a<-table.element(a,'Parameter',header=TRUE)
a<-table.element(a,'S.D.',header=TRUE)
a<-table.element(a,'T-STAT<br />H0: parameter = 0',header=TRUE)
a<-table.element(a,'2-tail p-value',header=TRUE)
a<-table.element(a,'1-tail p-value',header=TRUE)
a<-table.row.end(a)
for (i in 1:k){
a<-table.row.start(a)
a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
a<-table.element(a,mysum$coefficients[i,1])
a<-table.element(a, round(mysum$coefficients[i,2],6))
a<-table.element(a, round(mysum$coefficients[i,3],4))
a<-table.element(a, round(mysum$coefficients[i,4],6))
a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable2.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Multiple R',1,TRUE)
a<-table.element(a, sqrt(mysum$r.squared))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'R-squared',1,TRUE)
a<-table.element(a, mysum$r.squared)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Adjusted R-squared',1,TRUE)
a<-table.element(a, mysum$adj.r.squared)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (value)',1,TRUE)
a<-table.element(a, mysum$fstatistic[1])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
a<-table.element(a, mysum$fstatistic[2])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
a<-table.element(a, mysum$fstatistic[3])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'p-value',1,TRUE)
a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
a<-table.element(a, mysum$sigma)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
a<-table.element(a, sum(myerror*myerror))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable3.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Time or Index', 1, TRUE)
a<-table.element(a, 'Actuals', 1, TRUE)
a<-table.element(a, 'Interpolation<br />Forecast', 1, TRUE)
a<-table.element(a, 'Residuals<br />Prediction Error', 1, TRUE)
a<-table.row.end(a)
for (i in 1:n) {
a<-table.row.start(a)
a<-table.element(a,i, 1, TRUE)
a<-table.element(a,x[i])
a<-table.element(a,x[i]-mysum$resid[i])
a<-table.element(a,mysum$resid[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable4.tab')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by