Home » date » 2007 » Nov » 22 » attachments

Stat Opdr3 Q3-3

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Thu, 22 Nov 2007 13:02:35 -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/22/t1195761516oevr0i6sppbh2zr.htm/, Retrieved Thu, 22 Nov 2007 20:58:46 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
3804 0 3491 0 4151 0 4254 1 4717 1 4866 1 4001 1 3758 1 4780 1 5016 1 4296 0 4467 0 3891 0 3872 0 3867 0 3973 1 4640 1 4538 1 3836 1 3770 1 4374 1 4497 1 3945 0 3862 0 3608 0 3301 0 3882 0 3605 0 4305 1 4216 1 3971 1 3988 1 4317 1 4484 1 4247 0 3520 0 3686 0 3403 0 3990 0 4053 0 4548 1 4559 1 3922 1 4209 1 4517 1 4386 1 3221 0 3127 0 3777 0 3322 0 3899 0 4033 1 4463 1 4819 1 4246 1 4255 1 4760 1 4581 0 4309 0 4016 0 3601 0 3257 0 3823 0 3940 1 4534 1 4575 1 3953 1 4206 1 4649 1 4353 1 3835 0 3944 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 time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
O[t] = + 3905.27517025584 + 106.659856432909T[t] -116.468893797163M1[t] -401.335357997423M2[t] + 94.9648444689857M3[t] + 66.8251426467886M4[t] + 591.405392968894M5[t] + 654.37226210197M6[t] + 49.005797901712M7[t] + 93.8060003681218M8[t] + 630.939536167863M9[t] + 637.349714706424M10[t] + 150.866464200258M11[t] -1.96686913307567t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)3905.27517025584118.30642933.009800
T106.659856432909169.7531750.62830.5322590.266129
M1-116.468893797163144.770732-0.80450.424390.212195
M2-401.335357997423144.620908-2.77510.0074150.003707
M394.9648444689857144.485220.65730.5136110.256806
M466.8251426467886182.9346710.36530.716220.35811
M5591.405392968894222.2294222.66120.0100540.005027
M6654.37226210197222.2462162.94440.004650.002325
M749.005797901712222.2722980.22050.8262740.413137
M893.8060003681218222.3076640.4220.6746110.337305
M9630.939536167863222.352312.83760.0062540.003127
M10637.349714706424201.6706093.16040.0025040.001252
M11150.866464200258143.9124971.04830.298840.14942
t-1.966869133075671.436888-1.36880.1763280.088164


Multiple Linear Regression - Regression Statistics
Multiple R0.853144229923228
R-squared0.727855077051297
Adjusted R-squared0.666857077080036
F-TEST (value)11.9324416766816
F-TEST (DF numerator)13
F-TEST (DF denominator)58
p-value5.19650988906051e-12
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation249.251332461467
Sum Squared Residuals3603321.15056138


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
138043786.8394073255917.1605926744128
234913500.00607399227-9.00607399226925
341513994.3394073256156.660592674397
442544070.89269280324183.10730719676
547174593.50607399227123.493926007730
648664654.50607399227211.493926007729
740014047.17274065894-46.1727406589373
837584090.00607399227-332.00607399227
947804625.17274065894154.827259341064
1050164629.61605006442386.383949935578
1142964034.50607399227261.49392600773
1244673881.67274065894585.327259341063
1338913763.2369777287127.763022271301
1438723476.40364439536395.596355604638
1538673970.7369777287-103.736977728695
1639734047.29026320633-74.2902632063318
1746404569.9036443953670.096355604638
1845384630.90364439536-92.903644395362
1938364023.57031106203-187.570311062028
2037704066.40364439536-296.403644395362
2143744601.57031106203-227.570311062029
2244974606.01362046751-109.013620467514
2339454010.90364439536-65.903644395362
2438623858.070311062033.9296889379713
2536083739.63454813179-131.634548131790
2633013452.80121479845-151.801214798454
2738823947.13454813179-65.1345481317873
2836053917.02797717651-312.027977176514
2943054546.30121479845-241.301214798454
3042164607.30121479845-391.301214798454
3139713999.96788146512-28.9678814651206
3239884042.80121479845-54.8012147984541
3343174577.96788146512-260.967881465121
3444844582.41119087061-98.4111908706055
3542473987.30121479845259.698785201546
3635203834.46788146512-314.467881465121
3736863716.03211853488-30.0321185348824
3834033429.19878520155-26.1987852015461
3939903923.5321185348866.4678814651207
4040533893.42554757961159.574452420394
4145484522.6987852015525.3012147984541
4245594583.69878520155-24.698785201546
4339223976.36545186821-54.3654518682126
4442094019.19878520155189.801214798454
4545174554.36545186821-37.3654518682127
4643864558.8087612737-172.808761273697
4732213963.69878520155-742.698785201546
4831273810.86545186821-683.865451868213
4937773692.4296889379784.5703110620255
5033223405.59635560464-83.5963556046381
5138993899.92968893797-0.929688937971274
5240333976.4829744156156.5170255843923
5344634499.09635560464-36.0963556046379
5448194560.09635560464258.903644395362
5542463952.76302227130293.236977728695
5642553995.59635560464259.403644395362
5747604530.76302227131229.236977728695
5845814428.54647524388152.453524756120
5943093940.09635560464368.903644395362
6040163787.26302227130228.736977728695
6136013668.82725934107-67.8272593410664
6232573381.99392600773-124.99392600773
6338233876.32725934106-53.3272593410632
6439403952.8805448187-12.8805448186997
6545344475.4939260077358.5060739922701
6645754536.4939260077338.5060739922701
6739533929.1605926744023.8394073256035
6842063971.99392600773234.00607399227
6946494507.16059267440141.839407325603
7043534511.60390207988-158.603902079881
7138353916.49392600773-81.4939260077299
7239443763.6605926744180.339407325603
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/1gtny1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/1gtny1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/23p6f1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/23p6f1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/3iwn91195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/3iwn91195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/4x63e1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/4x63e1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/5oo8a1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/5oo8a1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/6nzcc1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/6nzcc1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/7tu9g1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/7tu9g1195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/8aqr21195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/8aqr21195761751.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/91ueo1195761751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/22/t1195761516oevr0i6sppbh2zr/91ueo1195761751.ps (open in new window)


 
Parameters:
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