Home » date » 2007 » Dec » 07 » attachments

Tijdreeks 1 Outliers?

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Fri, 07 Dec 2007 04:41: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/2007/Dec/07/t1197026934aeohpvkw9wt135c.htm/, Retrieved Fri, 07 Dec 2007 12:29:04 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
1,1608 0 1,1208 0 1,0883 0 1,0704 0 1,0628 0 1,0378 0 1,0353 0 1,0604 0 1,0501 0 1,0706 0 1,0338 0 1,0110 0 1,0137 0 0,9834 0 0,9643 0 0,9470 0 0,9060 0 0,9492 0 0,9397 0 0,9041 0 0,8721 0 0,8552 0 0,8564 0 0,8973 0 0,9383 0 0,9217 0 0,9095 0 0,8920 0 0,8742 0 0,8532 0 0,8607 0 0,9005 0 0,9111 1 0,9059 1 0,8883 1 0,8924 1 0,8833 1 0,8700 1 0,8758 1 0,8858 1 0,9170 1 0,9554 1 0,9922 1 0,9778 1 0,9808 1 0,9811 1 1,0014 1 1,0183 1 1,0622 1 1,0773 1 1,0807 1 1,0848 1 1,1582 1 1,1663 1 1,1372 1 1,1139 1 1,1222 1 1,1692 1 1,1702 1 1,2286 1
 
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] = + 0.978875 + 0.0468416666666669x[t] + 0.0122844444444448M1[t] -0.00480611111111124M2[t] -0.0157966666666668M3[t] -0.0235872222222223M4[t] -0.0160177777777779M5[t] -0.00734833333333342M6[t] -0.00677888888888897M7[t] -0.00852944444444454M8[t] -0.0220483333333335M9[t] -0.012978888888889M10[t] -0.0194294444444445M11[t] + 7.05555555555448e-05t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)0.9788750.06072716.119300
x0.04684166666666690.0584350.80160.4269010.21345
M10.01228444444444480.0708680.17330.8631430.431572
M2-0.004806111111111240.070687-0.0680.9460870.473044
M3-0.01579666666666680.070546-0.22390.8238120.411906
M4-0.02358722222222230.070445-0.33480.7392750.369638
M5-0.01601777777777790.070385-0.22760.8209860.410493
M6-0.007348333333333420.070365-0.10440.917280.45864
M7-0.006778888888888970.070385-0.09630.9236910.461846
M8-0.008529444444444540.070445-0.12110.9041560.452078
M9-0.02204833333333350.070304-0.31360.7552310.377616
M10-0.0129788888888890.070203-0.18490.8541380.427069
M11-0.01942944444444450.070142-0.2770.7830190.39151
t7.05555555555448e-050.0016870.04180.9668180.483409


Multiple Linear Regression - Regression Statistics
Multiple R0.257737388983056
R-squared0.0664285616798032
Adjusted R-squared-0.197406844801991
F-TEST (value)0.251780314725829
F-TEST (DF numerator)13
F-TEST (DF denominator)46
p-value0.995250764916281
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.110871822749110
Sum Squared Residuals0.565457809666667


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
11.16080.9912299999999980.169570000000002
21.12080.974210.146590000000000
31.08830.963290.12501
41.07040.955570.11483
51.06280.963210.0995899999999999
61.03780.971950.0658499999999999
71.03530.972590.0627099999999999
81.06040.970910.0894899999999999
91.05010.9574616666666670.0926383333333332
101.07060.9666016666666670.103998333333333
111.03380.9602216666666670.0735783333333333
121.0110.9797216666666670.0312783333333331
131.01370.9920766666666670.0216233333333328
140.98340.9750566666666670.0083433333333333
150.96430.9641366666666670.000163333333333293
160.9470.956416666666667-0.00941666666666674
170.9060.964056666666667-0.0580566666666666
180.94920.972796666666667-0.0235966666666667
190.93970.973436666666667-0.0337366666666667
200.90410.971756666666667-0.0676566666666667
210.87210.958308333333333-0.0862083333333333
220.85520.967448333333333-0.112248333333333
230.85640.961068333333333-0.104668333333333
240.89730.980568333333333-0.0832683333333334
250.93830.992923333333334-0.0546233333333338
260.92170.975903333333333-0.0542033333333333
270.90950.964983333333333-0.0554833333333333
280.8920.957263333333333-0.0652633333333332
290.87420.964903333333333-0.0907033333333332
300.85320.973643333333333-0.120443333333333
310.86070.974283333333333-0.113583333333333
320.90050.972603333333333-0.0721033333333332
330.91111.00599666666667-0.0948966666666668
340.90591.01513666666667-0.109236666666667
350.88831.00875666666667-0.120456666666667
360.89241.02825666666667-0.135856666666667
370.88331.04061166666667-0.157311666666667
380.871.02359166666667-0.153591666666667
390.87581.01267166666667-0.136871666666667
400.88581.00495166666667-0.119151666666667
410.9171.01259166666667-0.0955916666666666
420.95541.02133166666667-0.0659316666666667
430.99221.02197166666667-0.0297716666666667
440.97781.02029166666667-0.0424916666666666
450.98081.00684333333333-0.0260433333333333
460.98111.01598333333333-0.0348833333333333
471.00141.00960333333333-0.00820333333333322
481.01831.02910333333333-0.0108033333333334
491.06221.041458333333330.0207416666666663
501.07731.024438333333330.0528616666666666
511.08071.013518333333330.0671816666666667
521.08481.005798333333330.0790016666666668
531.15821.013438333333330.144761666666667
541.16631.022178333333330.144121666666667
551.13721.022818333333330.114381666666667
561.11391.021138333333330.0927616666666667
571.12221.007690.114510000000000
581.16921.016830.15237
591.17021.010450.15975
601.22861.029950.19865
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/1u0691197027688.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/1u0691197027688.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/2fs141197027688.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/2fs141197027688.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/3ibwu1197027688.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/3ibwu1197027688.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/4rqze1197027688.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/4rqze1197027688.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/5vro91197027688.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/5vro91197027688.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/6czqp1197027689.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/6czqp1197027689.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/7jrc71197027689.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/7jrc71197027689.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/8lsjt1197027689.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/8lsjt1197027689.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/9v4ap1197027689.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/07/t1197026934aeohpvkw9wt135c/9v4ap1197027689.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