Home » date » 2007 » Dec » 15 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sat, 15 Dec 2007 15:45:06 -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/15/t1197758034etvzemokz475bzu.htm/, Retrieved Sat, 15 Dec 2007 23:34:04 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
85.6 92.81 88 75.6 89 59.04 88.4 48.7 97.5 72.81 95 111.7 104 91.81 101.8 119.5 99.4 68.07 107.6 103.4 103.2 49.16 118.9 96.3 103 124.61 126.9 96.6 91.2 109.89 106.3 110.4 85.9 110.51 109.2 104.4 80.7 114.77 104.6 110.7 86.7 92.37 100.8 93.6 80.7 103.63 92.1 114.8 81.5 90.43 86.4 74.9 83.4 65.86 96 69.8 83.5 83.33 98.5 104.2 89.5 94.49 112 109.3 85.8 68.98 113.9 92.7 77.4 55.46 120 91.7 67.5 132.89 126.7 84.4 63.7 121.71 112.8 94.5 59.4 127.01 116.2 103.6 62 134.04 110.6 105.9 62.4 106.48 105 108 58.1 117.55 101.2 119.9 58 101.61 99.3 84.5 56.3 82.66 101.9 76.7 61.4 89.28 106.4 120.5 59.8 109.24 118.9 119.6 54.3 88.16 121.9 102.3 47 59.23 132 101.7 50.5 164.21 121.4 86.9 48.1 125.13 117 93.6 58.8 152.68 122.7 113.6 70.4 132.96 113 106.7 71.9 112.42 104 96.1 73.3 136.43 101.2 124.6 83.5 107.32 100.8 72.5 90.1 87.61 98.9 89 101.3 97.86 103 115.3 98.3 106.60 117.8 119.1 106.7 92.17 126.6 104.4 109.9 65.31 127.6 104.9 111.1 161.49 115.8 76.9 119 162.25 114.8 95.3 120.7 175.13 119.2 114.9 104.5 147.28 109.9 98.9 121.6 144.48 98.9 102.9 129.6 122.67 98.6 90 124.5 102.27 96.6 81 130.1 88.64 96.7 66.2 142.3 89.59 103.5 86.7 140 112.20 115.3 86.7 143.3 91.98 122.5 103.4 113.4 57.85 125.3 89.5 113.8 160.49 111.2 113.7 120.7 128.33 110.7 120.2 112.9 140.69 114.2 137.8 115.5 126.61 105.6 99.1 121.9 129.27 95.5 110.4 119.3 124.27 97.3 112.3 111 112.90 95.5 82.2 114.2 92.54 96.3 72.2 113.5 85.70 100.2 106.7 94 116.72 113.4 106.4 83.2 92.08 121.4 110 82.8 58.98 122.1 87.5 85.8 154.50 119.3 79.7 88.7 145.55 110.8 83.3 105.3 146.60 110.1 91.8 113.1 143.51 99.7 89.2 113.8 113.52 104.8 90.6 109.4 104.80 105.4 92.6
 
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
olie[t] = + 266.990447890280 + 0.0738268262780373auto[t] -1.94100985624765electric[t] -0.140847432036701vervoer[t] -9.69338508432732M1[t] -2.94497280317953M2[t] + 16.3592288303806M3[t] + 35.8549981526060M4[t] + 44.8296305047298M5[t] + 48.893937994268M6[t] + 32.3703754437297M7[t] + 18.5310130663871M8[t] + 26.9018041142079M9[t] + 10.5413368531085M10[t] + 5.13864638469737M11[t] + 0.653509189796642t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)266.99044789028059.3743464.49673.5e-051.8e-05
auto0.07382682627803730.2629540.28080.779930.389965
electric-1.941009856247650.55603-3.49080.0009470.000473
vervoer-0.1408474320367010.254161-0.55420.5816720.290836
M1-9.6933850843273214.705934-0.65910.5125020.256251
M2-2.9449728031795317.124992-0.1720.8640820.432041
M316.359228830380614.5079541.12760.2642950.132148
M435.854998152606015.1172732.37180.0211650.010582
M544.829630504729819.4030662.31040.0245720.012286
M648.89393799426825.5325011.9150.0606090.030305
M732.370375443729719.6190871.64990.1045530.052277
M818.531013066387114.9268311.24150.2196120.109806
M926.901804114207915.9170391.69010.0965640.048282
M1010.541336853108513.7769770.76510.44740.2237
M115.1386463846973712.554530.40930.6838760.341938
t0.6535091897966420.1629064.01160.0001819e-05


Multiple Linear Regression - Regression Statistics
Multiple R0.640211545029573
R-squared0.409870822389154
Adjusted R-squared0.251800506957677
F-TEST (value)2.59296517040755
F-TEST (DF numerator)15
F-TEST (DF denominator)56
p-value0.00510596940206898
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation21.2585706020548
Sum Squared Residuals25307.9021463827


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
185.683.34550653084512.25449346915486
28991.2666880576695-2.26668805766948
397.590.55694100932826.9430589906718
410497.81145222826266.18854777173742
599.496.6967314038972.70326859610300
6103.279.085088190176224.1149118098238
710353.214935792520249.7850642074798
891.276.983460198756814.2165398012432
985.981.26968907776854.63031092223150
1080.773.91853980331826.78146019668178
1186.777.29996615764449.4000338423556
1280.787.546939216811-6.84693921681092
1381.594.2161179342861-12.7161179342861
1483.481.88874156698891.51125843301116
1583.593.4385307427412-9.93853074274125
1689.587.48976167329572.01023832670432
1785.893.8847295218022-8.0847295218022
1877.485.905094818784-8.50509481878397
1967.563.77487283375933.72512716624068
2063.775.3211136666966-11.6211136666966
2159.476.8555509408117-17.4555509408117
226272.213301559546-10.2133015595460
2362.476.0033285364186-13.6033285364185
2458.178.03520732092-19.9352073209200
255876.4924496364872-18.4924496364872
2656.378.5473370931052-22.2473370931052
2761.484.0901196301006-22.6901196301006
2859.881.5771210803696-21.7771210803696
2954.386.2626241298411-31.9626241298411
304769.324939636073-22.3249396360730
3150.583.864472968368-33.364472968368
3248.175.3902329827201-27.2902329827201
3358.872.5677574629518-13.7677574629518
3470.475.2045772641017-4.80457726410166
3571.987.9010644595542-16.0010644595542
3673.386.6091851480366-13.3091851480366
3783.583.5347654921634-0.0347654921634399
3890.190.8454963154327-0.745496315432724
39101.399.89750423495881.40249576504123
4098.391.4298630944466.87013690555391
41106.784.982254049134721.7177459508653
42109.985.705648602375424.1943513976246
43111.1103.7839037938057.3160962061947
4411990.00357610100328.996423898997
45120.788.677712825672632.0222871743274
46104.591.219628218216913.2803717817831
47121.6107.05145051660114.5485494833988
48129.6103.35538507072426.2446149292757
49124.597.959088520947226.5409114790528
50130.1106.24519135824023.8548086417596
51142.3110.18679828732532.1132017126751
52140109.10138503777130.8986149622290
53143.3100.90932507235442.3906749276463
54113.499.630383878635813.7696161213642
55113.8115.297647084876-1.49764708487557
56120.799.792519784113220.9074802158868
57112.9100.45687029381412.4431297061856
58115.5105.8539108920679.64608910793288
59121.9119.3137325374392.58626746256124
60119.3110.6980333490328.60196665096763
61111108.5520718852712.44792811472914
62114.2114.306545608563-0.106545608563337
63113.5121.330106095546-7.83010609554628
6494118.190416885855-24.190416885855
6583.2109.964335822971-26.7643358229713
6682.8114.048844873956-31.2488448739556
6785.8111.764167526672-25.9641675266717
6888.7113.909097266710-25.2090972667102
69105.3123.172419398981-17.872419398981
70113.1127.79004226275-14.6900422627501
71113.8110.7304577923433.06954220765711
72109.4104.1552498944765.24475010552434
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/199221197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/199221197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/2b15i1197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/2b15i1197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/33kmd1197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/33kmd1197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/4sqm91197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/4sqm91197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/52ta31197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/52ta31197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/6xop31197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/6xop31197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/7f2yh1197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/7f2yh1197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/8shur1197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/8shur1197758701.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/92nmz1197758701.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197758034etvzemokz475bzu/92nmz1197758701.ps (open in new window)


 
Parameters (Session):
 
Parameters (R input):
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