Home » date » 2007 » Dec » 13 » attachments

paper

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Thu, 13 Dec 2007 13:05:34 -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/13/t1197575459fv8382v7h6qbzo6.htm/, Retrieved Thu, 13 Dec 2007 20:51:09 +0100
 
User-defined keywords:
zonder iets
 
Dataseries X:
» Textbox « » Textfile « » CSV «
103,1 98,6 98,1 98,6 100,6 98 101,1 98 103,1 106,8 111,1 106,8 95,5 96,6 93,3 96,7 90,5 100,1 100 100,2 90,9 107,7 108 107,7 88,8 91,5 70,4 92 90,7 97,8 75,4 98,4 94,3 107,4 105,5 107,4 104,6 117,5 112,3 117,7 111,1 105,6 102,5 105,7 110,8 97,4 93,5 97,5 107,2 99,5 86,7 99,9 99 98 95,2 98,2 99 104,3 103,8 104,5 91 100,6 97 100,8 96,2 101,1 95,5 101,5 96,9 103,9 101 103,9 96,2 96,9 67,5 99,6 100,1 95,5 64 98,4 99 108,4 106,7 112,7 115,4 117 100,6 118,4 106,9 103,8 101,2 108,1 107,1 100,8 93,1 105,4 99,3 110,6 84,2 114,6 99,2 104 85,8 106,9 108,3 112,6 91,8 115,9 105,6 107,3 92,4 109,8 99,5 98,9 80,3 101,8 107,4 109,8 79,7 114,2 93,1 104,9 62,5 110,8 88,1 102,2 57,1 108,4 110,7 123,9 100,8 127,5 113,1 124,9 100,7 128,6 99,6 112,7 86,2 116,6 93,6 121,9 83,2 127,4 98,6 100,6 71,7 105 99,6 104,3 77,5 108,3 114,3 120,4 89,8 125 107,8 107,5 80,3 111,6 101,2 102,9 78,7 106,5 112,5 125,6 93,8 130,3 100,5 107,5 57,6 115 93,9 108,8 60,6 116,1 116,2 128,4 91 134 112 121,1 85,3 126,5 106,4 119,5 77,4 125,8 95,7 128,7 77,3 136,4 96 108,7 68,3 114,9 95,8 105,5 69,9 110,9 103 119,8 81,7 125,5 102,2 111,3 75,1 116,8 98,4 110,6 69,9 116,8 111,4 120,1 84 125,5 86,6 97,5 54,3 104,2 91,3 107,7 60 115,1 107,9 127,3 89,9 132,8 101,8 117,2 77 123,3 104,4 119,8 85,3 124,8 93,4 116,2 77,6 122 100,1 111 69,2 117,4 98,5 112,4 75,5 117,9 112,9 130,6 85,7 137,4 101,4 109,1 72,2 114,6 107,1 118,8 79,9 124,7 110,8 123,9 85,3 129,6 90,3 101,6 52,2 109,4 95,5 112,8 61,2 120,9 111,4 128 82,4 134,9 113 129,6 85,4 136,3 107,5 125,8 78,2 133,2 95,9 119,5 70,2 127,2 106,3 115,7 70,2 122,7 105,2 113,6 69,3 120,5 117,2 129,7 77,5 137,8 106,9 112 66,1 119,1 108,2 116,8 69 124,3 110 126,3 75,3 134,3 96,1 112,9 58,2 121,7 100,6 115,9 59,7 125
 
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
Totaal[t] = + 0.985561382674693 + 0.00512745466226638Intermediaire[t] + 0.0791606277930283Duurzame[t] + 0.90284901497009`Niet-Duurzaam`[t] + 0.432723397663192M1[t] + 0.516710710020281M2[t] + 0.490458302459475M3[t] + 0.669615430179371M4[t] + 0.61141179663758M5[t] + 0.753034886197928M6[t] + 0.209506335240211M7[t] + 0.237812110676649M8[t] + 0.227756213647851M9[t] + 0.872187181607412M10[t] + 0.158817514259807M11[t] -0.0396749980712203t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)0.9855613826746932.7727670.35540.7234260.361713
Intermediaire0.005127454662266380.0172060.2980.7666640.383332
Duurzame0.07916062779302830.0180074.3964.2e-052.1e-05
`Niet-Duurzaam`0.902849014970090.01941846.495900
M10.4327233976631920.4682450.92410.3588850.179443
M20.5167107100202810.4681981.10360.2738920.136946
M30.4904583024594750.4772181.02770.3079380.153969
M40.6696154301793710.4675551.43220.1569630.078481
M50.611411796637580.4608171.32680.189290.094645
M60.7530348861979280.4600181.6370.1065450.053273
M70.2095063352402110.6122220.34220.7333170.366658
M80.2378121106766490.5655330.42050.6755210.337761
M90.2277562136478510.5184480.43930.6619210.330961
M100.8721871816074120.5174431.68560.0967480.048374
M110.1588175142598070.4716450.33670.7374210.368711
t-0.03967499807122030.011194-3.54440.0007410.000371


Multiple Linear Regression - Regression Statistics
Multiple R0.997583351309772
R-squared0.995172542810435
Adjusted R-squared0.994041107531631
F-TEST (value)879.566477600183
F-TEST (DF numerator)15
F-TEST (DF denominator)64
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.776644682526761
Sum Squared Residuals38.603325625414


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
198.698.693820820494-0.0938208204939932
29898.4210869725206-0.421086972520612
3106.8107.104655813211-0.304655813211284
496.696.677335061513-0.0773350615129729
5100.1100.244166915197-0.144166915197194
6107.7107.752818623171-0.0528186231711168
791.590.00767827930311.49232172069685
897.896.18008805530041.61991194469960
9107.4106.6571920282850.742807971714512
10117.5117.1523979043800.347602095620312
11105.6104.8227193622530.777280637747145
1297.496.50688104063120.893118959368851
1399.598.51001597037460.989984029625405
149897.65030516722150.349694832778541
15104.3103.9531079549210.346892045078962
16100.6100.1727368228900.427263177110341
17101.1100.614774324310.485225675690042
18103.9103.3225327228530.577467277147464
1996.996.20160816012220.69839183987783
2095.594.84975499543050.650245004569463
21108.4111.085283621037-2.6852836210366
22117116.4374894031780.56251059682184
23103.8106.389012895614-2.58901289561396
24100.8103.112652448673-2.31265244867262
25110.6111.067388052266-0.46738805226578
26104104.285907210285-0.285907210284583
27112.6112.867244543568-0.267244543568163
28107.3107.532999930987-0.232999930986981
2998.999.2232081098778-0.323208109877778
30109.8110.513494502152-0.713494502152117
31104.9105.425718902514-0.525718902514363
32102.2102.794407380558-0.59440738055769
33123.9123.5642925813090.335707418691071
34124.9125.166572296075-0.266572296074500
35112.7112.3622897100750.337710289924902
36121.9121.6463199480680.253680051931641
37100.6100.930840466022-0.330840466021845
38104.3104.418813625571-0.118813625570833
39120.4120.479514075329-0.0795140753288577
40107.5107.735464985040-0.235464985039839
41102.9102.8725581718400.0274418281604338
42125.6125.715578536975-0.115578536975179
43107.5108.391640876849-0.891640876849039
44108.8109.577046253289-0.777046253289476
45128.4128.2091380500310.190861949969342
46121.1121.569775519642-0.469775519641559
47119.5119.53065383807-0.0306538380700469
48128.7128.839581056756-0.139581056756431
49108.7109.110468220753-0.410468220752892
50105.5105.669015988695-0.169015988694799
51119.8119.7556972831520.0443027168478744
52111.3111.513830875397-0.213830875397224
53110.6110.984832651544-0.384832651543857
54120.1120.124388935764-0.0243889357639288
5597.597.832269846795-0.332269846794936
56107.7108.137269502667-0.437269502667028
57127.3126.5199846909430.780015309057217
58117.2117.495225446645-0.295225446645365
59119.8118.7668188964861.03318110351429
60116.2115.3744103069470.82558969305282
61111110.9837579104520.016242089547506
62112.4111.9700027598600.429997240140147
63130.6130.390904896770.209095103229893
64109.1108.8177952812790.28220471872121
65118.8118.4774550264450.322544973555076
66123.9123.4498022636200.45019773637979
67101.6101.903719011670-0.303719011669791
68112.8113.014221875572-0.21422187557207
69128127.3641090283960.635890971604458
70129.6129.4785394300810.121460569919273
71125.8125.3285052975020.471494702497667
72119.5119.0201551989240.479844801075742
73115.7115.4037085596380.296291440361599
74113.6113.3848682758480.21513172415214
75129.7129.6488754330480.0511245669515757
76112111.9498370428950.0501629571054628
77116.8116.7830048007870.0169951992132756
78126.3126.421384415465-0.121384415464915
79112.9113.037364922747-0.137364922746547
80115.9116.147211937183-0.247211937182799
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/1are81197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/1are81197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/2o5cj1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/2o5cj1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/34v5a1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/34v5a1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/473zu1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/473zu1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/51i1z1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/51i1z1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/651pw1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/651pw1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/7cwto1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/7cwto1197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/8me981197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/8me981197576329.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/9wlta1197576329.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/13/t1197575459fv8382v7h6qbzo6/9wlta1197576329.ps (open in new window)


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