Home » date » 2008 » Nov » 24 »

seatbelt

*The author of this computation has been verified*
R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 24 Nov 2008 14:13:33 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz.htm/, Retrieved Mon, 24 Nov 2008 21:14:37 +0000
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz.htm/},
    year = {2008},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2008},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
 
Feedback Forum:

Post a new message
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106.7 0 110.2 0 125.9 0 100.1 0 106.4 0 114.8 0 81.3 0 87 0 104.2 0 108 0 105 0 94.5 0 92 0 95.9 0 108.8 0 103.4 0 102.1 0 110.1 0 83.2 0 82.7 0 106.8 0 113.7 0 102.5 0 96.6 0 92.1 0 95.6 0 102.3 0 98.6 0 98.2 0 104.5 0 84 0 73.8 0 103.9 0 106 0 97.2 0 102.6 0 89 0 93.8 0 116.7 1 106.8 1 98.5 1 118.7 1 90 1 91.9 1 113.3 1 113.1 1 104.1 1 108.7 1 96.7 1 101 1 116.9 1 105.8 1 99 1 129.4 1 83 1 88.9 1 115.9 1 104.2 1 113.4 1 112.2 1 100.8 1 107.3 1 126.6 1 102.9 1 117.9 1 128.8 1 87.5 1 93.8 1 122.7 1 126.2 1 124.6 1 116.7 1 115.2 1 111.1 1 129.9 1 113.3 1 118.5 1 133.5 1 102.1 1 102.4 1
 
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 computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time5 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24


Multiple Linear Regression - Estimated Regression Equation
y[t] = + 97.545 + 5.53874999999999x[t] -5.30886408730161M1[t] -2.22558531746032M2[t] + 12.8950148809524M3[t] -0.964563492063495M4[t] + 0.30442956349206M5[t] + 14.3591369047619M6[t] -18.4290128968254M7[t] -17.2028769841270M8[t] + 6.26683035714286M9[t] + 6.88344246031746M10[t] + 2.70005456349206M11[t] + 0.116721230158730t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)97.5453.11727131.291800
x5.538749999999992.9694481.86520.0665930.033297
M1-5.308864087301613.660279-1.45040.1516830.075842
M2-2.225585317460323.658449-0.60830.5450490.272525
M312.89501488095243.6770183.50690.0008210.00041
M4-0.9645634920634953.671017-0.26280.7935610.39678
M50.304429563492063.6661270.0830.9340720.467036
M614.35913690476193.6623513.92070.0002130.000106
M7-18.42901289682543.659693-5.03574e-062e-06
M8-17.20287698412703.658156-4.70261.4e-057e-06
M96.266830357142863.7990891.64960.1037850.051892
M106.883442460317463.7963861.81320.0743550.037177
M112.700054563492063.7947630.71150.4792690.239634
t0.1167212301587300.0640781.82150.0730570.036529


Multiple Linear Regression - Regression Statistics
Multiple R0.881461940737189
R-squared0.776975152968171
Adjusted R-squared0.733046016431599
F-TEST (value)17.6870117244694
F-TEST (DF numerator)13
F-TEST (DF denominator)66
p-value1.11022302462516e-16
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation6.57178533306779
Sum Squared Residuals2850.43192261904


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1106.792.352857142857314.3471428571427
2110.295.552857142857114.6471428571429
3125.9110.79017857142915.1098214285714
4100.197.04732142857143.05267857142857
5106.498.43303571428577.96696428571428
6114.8112.6044642857142.19553571428571
781.379.93303571428571.36696428571429
88781.27589285714295.72410714285714
9104.2104.862321428571-0.662321428571411
10108105.5956547619052.40434523809524
11105101.5289880952383.47101190476191
1294.598.9456547619048-4.44565476190476
139293.7535119047619-1.75351190476188
1495.996.9535119047619-1.05351190476189
15108.8112.190833333333-3.39083333333333
16103.498.44797619047624.95202380952382
17102.199.83369047619052.26630952380952
18110.1114.005119047619-3.90511904761905
1983.281.33369047619051.86630952380953
2082.782.67654761904760.0234523809523847
21106.8106.2629761904760.537023809523803
22113.7106.9963095238106.70369047619048
23102.5102.929642857143-0.429642857142855
2496.6100.346309523810-3.74630952380953
2592.195.1541666666666-3.05416666666665
2695.698.3541666666667-2.75416666666667
27102.3113.591488095238-11.2914880952381
2898.699.848630952381-1.24863095238096
2998.2101.234345238095-3.03434523809523
30104.5115.405773809524-10.9057738095238
318482.73434523809521.26565476190476
3273.884.0772023809524-10.2772023809524
33103.9107.663630952381-3.76363095238095
34106108.396964285714-2.39696428571429
3597.2104.330297619048-7.13029761904762
36102.6101.7469642857140.853035714285705
378996.5548214285714-7.55482142857141
3893.899.7548214285714-5.95482142857143
39116.7120.530892857143-3.83089285714285
40106.8106.7880357142860.0119642857142872
4198.5108.17375-9.67375
42118.7122.345178571429-3.64517857142857
439089.673750.326250000000006
4491.991.01660714285710.883392857142866
45113.3114.603035714286-1.30303571428572
46113.1115.336369047619-2.23636904761905
47104.1111.269702380952-7.16970238095238
48108.7108.6863690476190.0136309523809534
4996.7103.494226190476-6.79422619047616
50101106.694226190476-5.69422619047619
51116.9121.931547619048-5.03154761904762
52105.8108.188690476190-2.38869047619048
5399109.574404761905-10.5744047619048
54129.4123.7458333333335.65416666666667
558391.0744047619048-8.07440476190476
5688.992.4172619047619-3.5172619047619
57115.9116.003690476190-0.103690476190477
58104.2116.737023809524-12.5370238095238
59113.4112.6703571428570.729642857142862
60112.2110.0870238095242.11297619047619
61100.8104.894880952381-4.09488095238094
62107.3108.094880952381-0.794880952380958
63126.6123.3322023809523.26779761904761
64102.9109.589345238095-6.68934523809524
65117.9110.9750595238106.92494047619048
66128.8125.1464880952383.65351190476191
6787.592.4750595238095-4.97505952380952
6893.893.8179166666667-0.0179166666666755
69122.7117.4043452380955.29565476190476
70126.2118.1376785714298.06232142857143
71124.6114.07101190476210.5289880952381
72116.7111.4876785714295.21232142857143
73115.2106.2955357142868.90446428571431
74111.1109.4955357142861.60446428571427
75129.9124.7328571428575.16714285714286
76113.3110.992.30999999999999
77118.5112.3757142857146.12428571428571
78133.5126.5471428571436.95285714285714
79102.193.87571428571438.2242857142857
80102.495.21857142857147.18142857142857
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/1gs8i1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/1gs8i1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/208mi1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/208mi1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/3w4ma1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/3w4ma1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/4bak91227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/4bak91227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/58zaq1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/58zaq1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/6yi1s1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/6yi1s1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/7n2em1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/7n2em1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/89yah1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/89yah1227561205.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/9p2qw1227561205.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Nov/24/t1227561276yqrukevi4v39ilz/9p2qw1227561205.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = Linear Trend ;
 
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:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

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