Home » date » 2007 » Nov » 19 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 19 Nov 2007 04:02:03 -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/19/t1195469816naum8tspmu7vf1l.htm/, Retrieved Mon, 19 Nov 2007 11:57:10 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106.54 107.89 1 106.44 107.26 1 106.57 107.76 1 106.12 107.32 1 106.13 107.15 1 106.26 108.04 1 105.78 106.52 1 105.77 106.62 0 105.2 106.47 0 105.15 105.46 0 105.01 106.13 0 104.75 105.15 0 104.96 105.39 0 105.26 104.57 0 105.13 104.29 0 104.77 104.09 0 104.79 104.51 0 104.4 103.39 0 103.89 102.71 0 103.93 102.62 0 103.48 101.94 0 103.45 101.65 0 103.47 101.86 0 103.5 101.27 0 103.69 101.21 0 103.57 102.15 0 103.47 102.07 0 102.85 102.8 0 102.54 103.39 0 102.39 102.71 0 102.16 102.65 0 101.51 101.12 0 100.83 100.29 0 100.55 99.79 0 100.88 100.11 0 101 99.76 0 100.51 99.96 0 100.44 99.98 0 100.32 100.49 0 99.98 100.75 0 100.03 100.84 0 99.64 100.44 0 99.11 99.57 0 98.97 99.22 0 98.6 99.08 0 98.31 98.04 0 98.37 98.73 0 98.19 98.72 0 98.51 100.07 0 98.23 99.02 0 97.96 98.94 0 97.77 99 0 97.49 98.54 0 97.76 98.42 0 98.01 97.9 0 97.73 97.46 0 97.06 97 0 96.63 95.97 0 96.58 96.55 0 96.66 96.51 0 96.77 96.76 0 96.5 96.05 0 96.53 96.47 0 96.22 96.38 0 96.49 97.27 0 96.34 96.67 0 96.31 96.59 0 96.06 96.06 0 95.9 96.92 0 95.33 94.96 0 95.53 95.59 0 95.42 95.68 0 95.57 95.35 0 95.3 95.41 0 95.31 95.32 0 95.38 95.8 0 95.22 95.46 0 94.62 94.16 0 93.81 92.49 0 93.6 91.58 0 93.2 91.5 0 93.29 90.83 0 93.54 91.28 0 93.23 90.57 0 93.46 90.93 0 92.82 90.9 0 92.85 91.49 0 92.67 91.38 0 92.32 90.91 0 92.06 90.72 0 91.88 89.53 0 91.53 89.47 0 91.19 89.28 0
 
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
Y[t] = -7.25303327622183 + 1.06594187359589X[t] + 0.89571223355923D[t] + 0.240549460095881M1[t] + 0.156251424685183M2[t] + 0.398463373048969M3[t] + 0.801831080443743M4[t] + 0.97051313109336M5[t] + 0.735706941760564M6[t] + 0.247728631943272M7[t] + 0.129941719407226M8[t] + 0.406195271893356M9[t] -0.131051760722312M10[t] + 0.274065231376367M11[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)-7.253033276221832.655996-2.73080.0077890.003894
X1.065941873595890.02655740.137300
D0.895712233559230.4580651.95540.0540690.027034
M10.2405494600958810.5269770.45650.6493040.324652
M20.1562514246851830.5269820.29650.7676240.383812
M30.3984633730489690.5269910.75610.4518320.225916
M40.8018310804437430.5271161.52120.132210.066105
M50.970513131093360.5271791.8410.0693820.034691
M60.7357069417605640.5273471.39510.1668920.083446
M70.2477286319432720.5277280.46940.6400590.320029
M80.1299417194072260.5245540.24770.8049950.402497
M90.4061952718933560.5248930.77390.4413210.220661
M10-0.1310517607223120.541683-0.24190.8094580.404729
M110.2740652313763670.5416880.50590.6143030.307151


Multiple Linear Regression - Regression Statistics
Multiple R0.982169333137103
R-squared0.964656598954982
Adjusted R-squared0.958840596251372
F-TEST (value)165.862474299768
F-TEST (DF numerator)13
F-TEST (DF denominator)79
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation1.01339534505927
Sum Squared Residuals81.1306399056367


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1107.89107.4486756303400.441324369660214
2107.26107.2577834075690.00221659243087586
3107.76107.6385677995000.121432200499641
4107.32107.562261663777-0.242261663777006
5107.15107.741603133163-0.59160313316256
6108.04107.6453693873970.394630612602762
7106.52106.645738978254-0.125738978253926
8106.62105.6215804134230.998419586577325
9106.47105.2902470979591.17975290204084
10105.46104.6997029716640.760297028336293
11106.13104.9555881014591.17441189854104
12105.15104.4043779829480.745622017052356
13105.39104.8687752364990.521224763501339
14104.57105.104259763167-0.534259763166749
15104.29105.207899267963-0.917899267963046
16104.09105.227527900863-1.13752790086330
17104.51105.417528788985-0.907528788984849
18103.39104.767005268950-1.37700526894966
19102.71103.735396603598-1.02539660359846
20102.62103.660247366006-1.04024736600625
21101.94103.456827075374-1.51682707537423
22101.65102.887601786551-1.23760178655068
23101.86103.314037616121-1.45403761612128
24101.27103.071950640953-1.80195064095279
25101.21103.515029057032-2.30502905703189
26102.15103.302817996790-1.15281799678967
27102.07103.438435757794-1.36843575779389
28102.8103.180919503559-0.380919503559199
29103.39103.0191595733940.370840426605899
30102.71102.6244621030220.085537896978079
31102.65101.8913171622780.758682837722442
32101.12101.0806680319040.0393319680958057
33100.29100.632081110345-0.34208111034511
3499.7999.7963703531226-0.00637035312259156
35100.11100.553248163508-0.443248163507919
3699.76100.407095956963-0.647095956963058
3799.96100.125333898997-0.16533389899697
3899.9899.96641993243450.0135800675654582
39100.49100.0807188559670.409281144033175
40100.75100.1216663263390.628333673660997
41100.84100.3436454706680.496354529331591
42100.4499.69312195063320.74687804936678
4399.5798.640194447810.92980555218989
4499.2298.37317567297060.846824327029367
4599.0898.25503073222630.82496926777372
4698.0497.40866055626780.631339443732197
4798.7397.87773406078220.85226593921776
4898.7297.41179929215861.30820070784139
49100.0797.99345015180522.07654984819481
5099.0297.61068839178761.40931160821236
5198.9497.56509603428051.37490396571948
529997.7659347856921.23406521430792
5398.5497.63615311173480.90384688826516
5498.4297.6891512282730.730848771727053
5597.997.46765838685460.432341613145376
5697.4697.05140774971170.40859225028826
579796.61348024688860.386519753111384
5895.9795.61787820862670.352121791373291
5996.5595.96969810704560.580301892954402
6096.5195.7809082255570.729091774443107
6196.7696.13871129174830.62128870825168
6296.0595.76660895046670.283391049533255
6396.4796.04079915503840.429200844961594
6496.3896.11372488161850.266275118381544
6597.2796.5702112381390.69978876186104
6696.6796.17551376776680.494486232233218
6796.5995.65555720174160.93444279825839
6896.0695.27128482080660.788715179193406
6996.9295.37698767351741.54301232648261
7094.9694.2321537729520.72784622704794
7195.5994.8504591397700.73954086023009
7295.6894.4591403022981.22085969770201
7395.3594.85958104343330.49041895656674
7495.4194.48747870215170.922521297848325
7595.3294.74035006925140.579649930748572
7695.895.21833370779790.581666292202097
7795.4695.21646505867220.243534941327815
7894.1694.3420937451819-0.182093745181858
7992.4992.9907025177519-0.500702517751894
8091.5892.6490678117607-1.0690678117607
8191.592.4989446148085-0.99894461480848
8290.8392.0576323508164-1.22763235081645
8391.2892.7292348113141-1.44923481131410
8490.5792.124727599123-1.55472759912301
8590.9392.6104436901459-1.68044369014592
8690.991.8439428556339-0.943942855633854
8791.4992.1181330602055-0.628133060205528
8891.3892.329631230353-0.94963123035305
8990.9192.125233625244-1.21523362524409
9090.7291.6132825487764-0.893282548776376
9189.5390.9334347017118-1.40343470171181
9289.4790.4425681334172-0.972568133417214
9389.2890.3564014488807-1.07640144888073
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/1vhed1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/1vhed1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/2ypyp1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/2ypyp1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/32cov1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/32cov1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/4dgbp1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/4dgbp1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/5ygaj1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/5ygaj1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/63hoc1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/63hoc1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/76o1n1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/76o1n1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/80hhe1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/80hhe1195470118.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/9su0h1195470118.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195469816naum8tspmu7vf1l/9su0h1195470118.ps (open in new window)


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