Home » date » 2007 » Nov » 25 » attachments

paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sun, 25 Nov 2007 10:34:14 -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/Nov/25/t1196011507df7jhyewou4y2tn.htm/, Retrieved Sun, 25 Nov 2007 18:25:17 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
8,7 0 8,5 0 8,2 0 8,3 0 8 0 8,1 0 8,7 0 9,3 0 8,9 0 8,8 0 8,4 0 8,4 0 7,3 0 7,2 0 7 0 7 0 6,9 0 6,9 0 7,1 0 7,5 0 7,4 0 8,9 0 8,3 1 8,3 1 9 1 8,9 1 8,8 1 7,8 1 7,8 1 7,8 1 9,2 1 9,3 1 9,2 1 8,6 1 8,5 1 8,5 1 9 1 9 1 8,8 1 8 1 7,9 1 8,1 1 9,3 1 9,4 1 9,4 1 9,3 1 9 1 9,1 1 9,7 1 9,7 1 9,6 1 8,3 1 8,2 1 8,4 1 10,6 1 10,9 1 10,9 1 9,6 1 9,3 1 9,3 1 9,6 1 9,5 1 9,5 1 9 1 8,9 1 9 1 10,1 1 10,2 1 10,2 1 9,5 1 9,3 1 9,3 1 9,4 1 9,3 1 9,1 1 9 1 8,9 1 9 1 9,8 1 10 1 9,8 1 9,4 1 9 1 8,9 1 9,3 1 9,1 1 8,8 1 8,9 1 8,7 1 8,6 1 9,1 1 9,3 1 8,9 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
WLHvrouwen[t] = + 7.78274496865721 + 0.820381062355658x[t] + 0.295018489497414M1[t] + 0.187880100076984M2[t] + 0.00574171065655037M3[t] -0.438896678763882M4[t] -0.571035068184316M5[t] -0.503173457604751M6[t] + 0.489688152974816M7[t] + 0.732549763554384M8[t] + 0.575411374133950M9[t] + 0.460045502034533M10[t] + 0.0071383894204342M11[t] + 0.0071383894204333t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)7.782744968657210.24236232.11200
x0.8203810623556580.203574.030.0001286.4e-05
M10.2950184894974140.2888621.02130.3102240.155112
M20.1878801000769840.2888810.65040.5173390.258669
M30.005741710656550370.2889360.01990.9841960.492098
M4-0.4388966787638820.289026-1.51850.1328710.066436
M5-0.5710350681843160.289152-1.97490.0517780.025889
M6-0.5031734576047510.289314-1.73920.0858960.042948
M70.4896881529748160.2895121.69140.0946970.047349
M80.7325497635543840.2897462.52830.0134560.006728
M90.5754113741339500.2900151.98410.050720.02536
M100.4600455020345330.2989731.53880.1278610.063931
M110.00713838942043420.297970.0240.9809480.490474
t0.00713838942043330.003222.21710.0294940.014747


Multiple Linear Regression - Regression Statistics
Multiple R0.788645798693523
R-squared0.621962195796944
Adjusted R-squared0.559753443206568
F-TEST (value)9.99798533001226
F-TEST (DF numerator)13
F-TEST (DF denominator)79
p-value5.30164800949251e-12
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.557417664560849
Sum Squared Residuals24.5464417683932


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
18.78.084901847575080.615098152424921
28.57.984901847575050.515098152424946
38.27.809901847575060.390098152424942
48.37.372401847575060.927598152424945
587.247401847575060.752598152424943
68.17.322401847575060.777598152424941
78.78.322401847575060.37759815242494
89.38.572401847575050.727598152424946
98.98.422401847575060.477598152424943
108.88.314174364896070.485825635103928
118.47.868405641702410.531594358297592
128.47.86840564170240.531594358297594
137.38.17056252062025-0.870562520620254
147.28.07056252062026-0.870562520620258
1577.89556252062026-0.895562520620256
1677.45806252062026-0.458062520620257
176.97.33306252062026-0.433062520620256
186.97.40806252062026-0.508062520620256
197.18.40806252062026-1.30806252062026
207.58.65806252062026-1.15806252062026
217.48.50806252062026-1.10806252062026
228.98.399835037941270.500164962058728
238.38.77444737710327-0.474447377103266
248.38.77444737710326-0.474447377103265
2599.07660425602111-0.0766042560211122
268.98.97660425602112-0.0766042560211162
278.88.80160425602111-0.00160425602111462
287.88.36410425602112-0.564104256021116
297.88.23910425602111-0.439104256021115
307.88.31410425602112-0.514104256021115
319.29.31410425602111-0.114104256021115
329.39.56410425602112-0.264104256021115
339.29.41410425602112-0.214104256021116
348.69.30587677334213-0.705876773342132
358.58.86010805014847-0.360108050148466
368.58.86010805014847-0.360108050148465
3799.16226492906631-0.162264929066312
3899.06226492906632-0.0622649290663162
398.88.88726492906632-0.0872649290663143
4088.44976492906632-0.449764929066315
417.98.32476492906632-0.424764929066314
428.18.39976492906631-0.299764929066315
439.39.39976492906631-0.0997649290663137
449.49.64976492906631-0.249764929066315
459.49.49976492906631-0.0997649290663147
469.39.39153744638733-0.0915374463873306
4798.945768723193670.0542312768063343
489.18.945768723193660.154231276806335
499.79.247925602111510.452074397888488
509.79.147925602111520.552074397888483
519.68.972925602111510.627074397888485
528.38.53542560211151-0.235425602111514
538.28.41042560211151-0.210425602111515
548.48.48542560211151-0.0854256021115142
5510.69.485425602111511.11457439788849
5610.99.735425602111521.16457439788848
5710.99.585425602111521.31457439788849
589.69.477198119432530.122801880567469
599.39.031429396238860.268570603761135
609.39.031429396238860.268570603761137
619.69.333586275156710.266413724843288
629.59.233586275156720.266413724843284
639.59.058586275156720.441413724843285
6498.621086275156720.378913724843285
658.98.496086275156710.403913724843286
6698.571086275156710.428913724843286
6710.19.571086275156710.528913724843286
6810.29.821086275156710.378913724843284
6910.29.671086275156710.528913724843285
709.59.56285879247773-0.0628587924777308
719.39.117090069284070.182909930715936
729.39.117090069284060.182909930715937
739.49.4192469482019-0.0192469482019105
749.39.31924694820191-0.0192469482019145
759.19.14424694820191-0.0442469482019143
7698.706746948201910.293253051798086
778.98.581746948201910.318253051798087
7898.656746948201910.343253051798086
799.89.656746948201910.143253051798087
80109.906746948201920.0932530517980854
819.89.756746948201910.0432530517980865
829.49.64851946552293-0.24851946552293
8399.20275074232926-0.202750742329265
848.99.20275074232926-0.302750742329263
859.39.50490762124711-0.20490762124711
869.19.40490762124712-0.304907621247115
878.89.22990762124711-0.429907621247113
888.98.792407621247110.107592378752886
898.78.667407621247110.0325923787528858
908.68.74240762124711-0.142407621247114
919.19.74240762124711-0.642407621247113
929.39.99240762124711-0.692407621247114
938.99.84240762124711-0.942407621247114
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/12wfh1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/12wfh1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/2066y1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/2066y1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/3ql9f1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/3ql9f1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/4irkw1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/4irkw1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/5a84w1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/5a84w1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/67qgj1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/67qgj1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/7sv1u1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/7sv1u1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/8a8jl1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/8a8jl1196012049.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/93c4r1196012049.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/25/t1196011507df7jhyewou4y2tn/93c4r1196012049.ps (open in new window)


 
Parameters:
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = 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