Home » date » 2007 » Dec » 05 » attachments

paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Wed, 05 Dec 2007 15:01:56 -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/05/t1196891347n9ja58b9854epid.htm/, Retrieved Wed, 05 Dec 2007 22:49:18 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106.7 97.3 0 104.8 93.5 110.2 101 0 105.6 94.7 125.9 113.2 0 118.3 112.9 100.1 101 0 89.9 99.2 106.4 105.7 0 90.2 105.6 114.8 113.9 0 107 113 81.3 86.4 0 64.5 83.1 87 96.5 0 92.6 81.1 104.2 103.3 0 95.8 96.9 108 114.9 0 94.3 104.3 105 105.8 0 91.2 97.7 94.5 94.2 0 86.3 102.6 92 98.4 0 77.6 89.9 95.9 99.4 0 82.5 96 108.8 108.8 0 97.7 112.7 103.4 112.6 0 83.3 107.1 102.1 104.4 0 84.2 106.2 110.1 112.2 0 92.8 121 83.2 81.1 0 77.4 101.2 82.7 97.1 0 72.5 83.2 106.8 112.6 0 88.8 105.1 113.7 113.8 0 93.4 113.3 102.5 107.8 0 92.6 99.1 96.6 103.2 0 90.7 100.3 92.1 103.3 0 81.6 93.5 95.6 101.2 0 84.1 98.8 102.3 107.7 0 88.1 106.2 98.6 110.4 0 85.3 98.3 98.2 101.9 0 82.9 102.1 104.5 115.9 0 84.8 117.1 84 89.9 0 71.2 101.5 73.8 88.6 0 68.9 80.5 103.9 117.2 0 94.3 105.9 106 123.9 0 97.6 109.5 97.2 100 0 85.6 97.2 102.6 103.6 0 91.9 114.5 89 94.1 0 75.8 93.5 93.8 98.7 0 79.8 100.9 116.7 119.5 0 99 121.1 106.8 112.7 0 88.5 116.5 98.5 104.4 0 86.7 109.3 118.7 124.7 0 97.9 118.1 90 89.1 0 94.3 108.3 91.9 97 0 72.9 105.4 113.3 121.6 0 91.8 116.2 113.1 118.8 0 93.2 111.2 104.1 114 0 86.5 105.8 108.7 111.5 0 98.9 122.7 96.7 97.2 0 77.2 99.5 101 102.5 0 79.4 107.9 116.9 113.4 0 90.4 124.6 105.8 109.8 0 81.4 115 99 104.9 0 85.8 110.3 129.4 126.1 0 103.6 132.7 83 80 0 73.6 99.7 88.9 96.8 0 75.7 96.5 115.9 117.2 1 99.2 118.7 104.2 112.3 1 88.7 112.9 113.4 117.3 1 94.6 130.5 112.2 111.1 1 98.7 137.9 100.8 102.2 1 84.2 115 107.3 104.3 1 87.7 116.8 126.6 122.9 1 103.3 140.9 102.9 107.6 1 88.2 120.7 117.9 121.3 1 93.4 134.2 128.8 131.5 1 106.3 147.3 87.5 89 1 73.1 112.4 93.8 104.4 1 78.6 107.1 122.7 128.9 1 101.6 128.4 126.2 135.9 1 101.4 137.7 124.6 133.3 1 98.5 135 116.7 121.3 1 99 151 115.2 120.5 1 89.5 137.4 111.1 120.4 1 83.5 132.4 129.9 137.9 1 97.4 161.3 113.3 126.1 1 87.8 139.8 118.5 133.2 1 90.4 146 133.5 146.6 1 97.1 154.6 102.1 103.4 1 79.4 142.1 102.4 117.2 1 85 120.5
 
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 time5 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Prod[t] = + 19.1968864455273 + 1.1337268515953Tot[t] -0.264635094351931Conjun[t] -0.264628251011800Mach[t] -0.0782681301598515`Elek `[t] + 0.0924904460551557t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)19.19688644552736.1735433.10950.002660.00133
Tot1.13372685159530.1359728.337900
Conjun-0.2646350943519312.274984-0.11630.9077110.453855
Mach-0.2646282510118000.12479-2.12060.0373070.018654
`Elek `-0.07826813015985150.095623-0.81850.4156980.207849
t0.09249044605515570.055281.67310.0985280.049264


Multiple Linear Regression - Regression Statistics
Multiple R0.922878188965104
R-squared0.85170415166751
Adjusted R-squared0.841684161915316
F-TEST (value)85.0005012710633
F-TEST (DF numerator)5
F-TEST (DF denominator)74
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation5.25380915697527
Sum Squared Residuals2042.58578868587


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
197.3105.206921080818-7.9069210808179
2101108.961831150456-7.96183115045556
3113.2122.068574409798-8.86857440979768
4101101.498627796619-0.498627796619182
5105.7108.153292899398-2.45329289939816
6113.9112.7441501186731.15584988132733
786.488.4437087960664-2.04370879606636
896.587.71892470310288.78107529689716
9103.3105.228070136834-1.92807013683375
10114.9109.4464808322865.45351916771417
11105.8107.474707960747-1.67470796074669
1294.296.5762310572258-2.37623105722575
1398.497.13067541112541.26932458887457
1499.499.8705865544694-0.470586554469342
15108.8109.258726197055-0.458726197054978
16112.6107.4780399879615.12196001203938
17104.4105.928961418175-1.52896141817511
18112.2111.6570953919250.542904608074616
1981.186.8773175728138-5.77731757281377
2097.189.10844936590647.99155063409357
21112.6110.4962443934152.10375560658479
22113.8116.552361493513-2.75236149351288
23107.8105.270221250782.52977874922
24103.299.08259519315354.11740480684653
25103.397.01365517632426.28634482367584
26101.299.99779788558621.20220211441385
27107.7106.0485610701001.65143892990029
28110.4103.3055394963487.09446050365188
29101.9103.282228109586-1.38222810958605
30115.9108.8403820913717.0596179086286
3189.990.511399123977-0.611399123977073
3288.681.29215139444427.3078486055558
33117.2106.80025199175810.3997480082421
34123.9108.11853032924915.7814696707512
35100102.372461494373-2.3724614943731
36103.6105.565880305903-1.96588030590310
3794.196.143831144909-2.04383114490905
3898.7100.040513311392-1.34051331139153
39119.5119.4334700103240.0665299896765028
40112.7111.4406946599441.25930534005560
41104.4103.1631136267311.23688637326927
42124.7122.5042905182722.19570948172791
4389.191.7785097027512-2.67850970275117
449799.9151033159535-2.9151033159535
45121.6118.4225786362993.17742136370136
46118.8118.3091848114170.490815188582529
47114110.3937907777573.60620922224281
48111.5111.0973030289030.402696971097087
4997.2105.143324922479-7.9433249224791
50102.5108.871206384825-6.37120638482532
51113.4122.771965236446-9.37196523644642
52109.8113.413115938435-3.61311593843453
53104.9104.999759700941-0.0997597009410196
54126.1133.093957451903-6.99395745190259
558091.103217809565-11.1032178095649
5696.897.579435369419-0.779435369419105
57117.2120.061599325869-2.86159932586941
58112.3110.1220373988112.17796260118940
59117.3117.705989107760-0.405989107759516
60111.1114.773847339569-3.67384733956903
61102.2107.571301497769-5.37130149776945
62104.3113.965934966365-9.66593496636503
63122.9129.924890995573-7.02489099557296
64107.6108.724957878327-1.12495787832671
65121.3123.390664435892-2.09066443589201
66131.5131.4017606211900.0982393788103453
678996.1885477725295-7.1885477725295
68104.4102.3828830929172.01711690708265
69128.9127.4865186044001.41348139559956
70135.9130.8720850707555.02791492924512
71133.3130.1293584336233.17064156637664
72121.3119.8808025440121.41919745598785
73120.5121.851117667460-1.35111766746044
74120.4119.2744381788451.12556182115509
75137.9134.7407117842083.15928821579202
76126.1120.2365325019315.86346749806875
77133.2125.0511067166608.14889328333979
78146.6139.7033847354916.89661526450892
79103.4109.859123711361-6.4591237113608
80117.2110.5004056186816.69959438131872
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/1bzr61196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/1bzr61196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/22g4a1196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/22g4a1196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/3meeg1196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/3meeg1196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/4cg6z1196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/4cg6z1196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/5z1431196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/5z1431196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/66hpt1196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/66hpt1196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/763w21196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/763w21196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/8uic41196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/8uic41196892109.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/9e50q1196892109.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/05/t1196891347n9ja58b9854epid/9e50q1196892109.ps (open in new window)


 
Parameters:
par1 = 2 ; par2 = Do not include Seasonal 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