Home » date » 2007 » Nov » 20 » attachments

Q3,W6, multiple regression, paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Tue, 20 Nov 2007 12:06:45 -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/20/t1195585220jalwtyy8k7jmvlw.htm/, Retrieved Tue, 20 Nov 2007 20:00:30 +0100
 
User-defined keywords:
paper, multiple regression
 
Dataseries X:
» Textbox « » Textfile « » CSV «
88,74 88,95 88,92 88,81 88,77 88,9 89,17 90,15 89,61 90,92 89,52 90,78 89,74 90,81 89,4 89,46 89,36 89,22 89,38 88,89 89,36 89,41 89,29 89,59 89,59 90,25 89,79 90,2 89,86 90,27 90,21 90,71 90,37 91,18 90,19 90,66 90,33 89,72 90,22 88,72 90,42 88,91 90,54 89,15 90,73 89,15 91,02 89,08 91,19 89,28 91,53 89,47 91,88 89,53 92,06 90,72 92,32 90,91 92,67 91,38 92,85 91,49 92,82 90,9 93,46 90,93 93,23 90,57 93,54 91,28 93,29 90,83 93,2 91,5 93,6 91,58 93,81 92,49 94,62 94,16 95,22 95,46 95,38 95,8 95,31 95,32 95,3 95,41 95,57 95,35 95,42 95,68 95,53 95,59 95,33 94,96 95.90 96.92 96.06 96.06 96.31 96.59 96.34 96.67 96.49 97.27 96.22 96.38 96.53 96.47 96.50 96.05 96.77 96.76 96.66 96.51 96.58 96.55 96.63 95.97 97.06 97.00 97.73 97.46 98.01 97.90 97.76 98.42 97.49 98.54 97.77 99.00 97.96 98.94 98.23 99.02 98.51 100.07 98.19 98.72 98.37 98.73 98.31 98.04 98.60 99.08 98.97 99.22 99.11 99.57 99.64 100.44 100.03 100.84 99.98 100.75 100.32 100.49 100.44 99.98 100.51 99.96 101.00 99.76 100.88 100.11 100.55 99.79 100.83 100.29 101.51 101.12 102.16 102.65 102.39 102.71 102.54 103.39 102.85 102.80 103.47 102.07 103.57 102.15 103.69 101.21 103.50 101.27 103.47 101.86 103.45 101.65 103.48 101.94 103.93 102.62 103.89 102.71 104.40 103.39 104.79 104.51 104.77 104.09 105.13 104.29 105.26 104.57 104.96 105.39 104.75 105.15 105.01 106.13 105.15 105.46 105.20 106.47 105.77 106.62 105.78 106.52 106.26 108.04 106.13 107.15 106.12 107.32 106.57 107.76 106.44 107.26 106.54 107.89
 
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 time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Y[t] = + 71.192346155451 + 0.189215809505315X[t] + 0.130691870654899t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)71.1923461554513.10465822.930800
X0.1892158095053150.0356155.31291e-060
t0.1306918706548990.00609921.427800


Multiple Linear Regression - Regression Statistics
Multiple R0.996691571344112
R-squared0.993394088388395
Adjusted R-squared0.993278195202227
F-TEST (value)8571.63497898886
F-TEST (DF numerator)2
F-TEST (DF denominator)114
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.453540662683154
Sum Squared Residuals23.4497011286064


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
188.7488.15378428160380.586215718396221
288.9288.25798593892780.662014061072154
388.7788.40570723243820.364292767561744
489.1788.77291886497480.397081135025204
589.6189.04930690894880.560693091051211
689.5289.1535085662730.366491433727052
789.7489.2898769112130.450123088786993
889.489.16512743903570.234872560964283
989.3689.25040751540930.109592484590652
1089.3889.31865816892750.0613418310725031
1189.3689.5477422605252-0.187742260525154
1289.2989.712492976891-0.422492976891004
1389.5989.9680672818194-0.378067281819413
1489.7990.089298361999-0.299298361999043
1589.8690.2332353393193-0.37323533931932
1690.2190.4471821661566-0.237182166156562
1790.3790.666805467279-0.296805467278951
1890.1990.6991051169911-0.50910511699109
1990.3390.651934126711-0.321934126710993
2090.2290.5934101878606-0.373410187860576
2190.4290.7600530623215-0.34005306232148
2290.5490.9361567272577-0.396156727257652
2390.7391.0668485979126-0.336848597912553
2491.0291.1842953619021-0.164295361902086
2591.1991.352830394458-0.162830394458047
2691.5391.5194732689190.0105267310810493
2791.8891.66151808814420.218481911855825
2892.0692.01737677211040.0426232278896090
2992.3292.18401964657130.135980353428692
3092.6792.40364294769370.266357052306304
3192.8592.55514855739420.294851442605812
3292.8292.5742031004410.245796899559047
3393.4692.7105714453810.749428554618989
3493.2392.7731456246140.456854375386017
3593.5493.03818072001770.501819279982345
3693.2993.08372547639520.206274523604838
3793.293.3411919394186-0.141191939418625
3893.693.4870210748340.112978925166043
3993.8193.78989933213870.0201006678613164
4094.6294.23658160466750.383418395332543
4195.2294.61325402767930.606745972320729
4295.3894.8082792735660.57172072643402
4395.3194.84814755565830.461852444341679
4495.394.99586884916870.304131150831297
4595.5795.11520777125330.454792228746713
4695.4295.3083408590450.111659140955067
4795.5395.42200330684440.107996693155647
4895.3395.433489217511-0.103489217510904
4995.995.9350440747962-0.0350440747962152
5096.0695.90301034927650.156989650723454
5196.3196.13398659896930.176013401030738
5296.3496.27981573438460.0601842656154157
5396.4996.5240370907427-0.0340370907426796
5496.2296.4863268909378-0.266326890937844
5596.5396.6340481844482-0.104048184448219
5696.596.685269415111-0.185269415110886
5796.7796.9503045105146-0.180304510514564
5896.6697.0336924287931-0.373692428793133
5996.5897.1719529318282-0.591952931828241
6096.6397.19289963297-0.56289963297006
6197.0697.5184837874154-0.458483787415427
6297.7397.7362149304428-0.00621493044276782
6398.0197.950161757280.0598382427199937
6497.7698.1792458488777-0.419245848877668
6597.4998.3326436166732-0.842643616673216
6697.7798.5503747597006-0.780374759700557
6797.9698.6697136817851-0.709713681785139
6898.2398.8155428172005-0.585542817200452
6998.5199.144911287836-0.63491128783593
7098.1999.0201618156587-0.830161815658661
7198.3799.1527458444086-0.782745844408607
7298.3199.1528788065048-0.842878806504841
7398.699.4803551190453-0.880355119045274
7498.9799.637537203031-0.667537203030912
7599.1199.8344546070127-0.72445460701267
7699.64100.129764231937-0.489764231937193
77100.03100.336142426394-0.306142426394218
7899.98100.449804874194-0.469804874193634
79100.32100.531300634377-0.211300634377161
80100.44100.565492442184-0.125492442184346
81100.51100.692399996649-0.182399996649129
82101100.7852487054030.214751294597028
83100.88100.982166109385-0.102166109384734
84100.55101.052308920998-0.502308920997932
85100.83101.277608696405-0.447608696405487
86101.51101.565349688950-0.0553496889497899
87102.16101.9855417481480.174458251852170
88102.39102.1275865673730.262413432626959
89102.54102.3869451884920.15305481150845
90102.85102.4059997315380.444000268461676
91103.47102.3985640612541.07143593874566
92103.57102.5443931966701.02560680333033
93103.69102.4972222063901.19277779361044
94103.5102.6392670256150.86073297438522
95103.47102.8815962238780.588403776122183
96103.45102.9725527745370.477447225463404
97103.48103.1581172299480.321882770051967
98103.93103.4174758510670.512524148933455
99103.89103.5651971445770.324802855423074
100104.4103.8245557656950.575444234304564
101104.79104.1671693429960.622830657003712
102104.77104.2183905736590.551609426341036
103105.13104.3869256062150.743074393785074
104105.26104.5705979035310.689402096468699
105104.96104.8564467379810.103553262019429
106104.75104.941726814354-0.191726814354188
107105.01105.257850178324-0.247850178324289
108105.15105.261767456611-0.111767456610626
109105.2105.583567294866-0.383567294865896
110105.77105.7426415369470.0273584630534
111105.78105.854411826651-0.0744118266509604
112106.26106.272711727754-0.0127117277539372
113106.13106.235001527949-0.105001527949114
114106.12106.397860086220-0.277860086219905
115106.57106.611806913057-0.0418069130571564
116106.44106.647890878959-0.207890878959393
117106.54106.897788709603-0.35778870960263
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/1g79j1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/1g79j1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/29mza1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/29mza1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/33sfo1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/33sfo1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/4la621195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/4la621195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/5abpl1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/5abpl1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/6w7em1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/6w7em1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/7eujk1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/7eujk1195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/85je01195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/85je01195585600.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/9fenq1195585600.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/20/t1195585220jalwtyy8k7jmvlw/9fenq1195585600.ps (open in new window)


 
Parameters:
par1 = 1 ; 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