Home » date » 2007 » Dec » 15 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sat, 15 Dec 2007 07:33:04 -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/15/t1197728218idhhl7efqfx2ruu.htm/, Retrieved Sat, 15 Dec 2007 15:17:08 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
99.5 0 101.6 0 103.9 0 106.6 0 108.3 0 102 0 93.8 0 91.6 0 97.7 0 94.8 0 98 0 103.8 0 97.8 0 91.2 0 89.3 0 87.5 0 90.4 0 94.2 0 102.2 0 101.3 0 96 0 90.8 0 93.2 0 90.9 0 91.1 0 90.2 0 94.3 0 96 0 99 0 103.3 0 113.1 0 112.8 0 112.1 0 107.4 0 111 0 110.5 0 110.8 0 112.4 0 111.5 0 116.2 0 122.5 0 121.3 0 113.9 0 110.7 0 120.8 0 141.1 1 147.4 1 148 1 158.1 1 165 1 187 1 190.3 1 182.4 1 168.8 1 151.2 1 120.1 0 112.5 0 106.2 0 107.1 0 108.5 0 106.5 0 108.3 0 125.6 0 124 0 127.2 0 136.9 0 135.8 0 124.3 0 115.4 0 113.6 0 114.4 0 118.4 0 117 0 116.5 0 115.4 0 113.6 0 117.4 0 116.9 0 116.4 0 111.1 0 110.2 0 118.9 0 131.8 0 130.6 0 138.3 0 148.4 0 148.7 0 144.3 0 152.5 0 162.9 0 167.2 0 166.5 0 185.6 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
Oliezaden[t] = + 88.7430371002373 + 48.0608092540424Fluctuatie[t] + 0.537151557341t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)88.74303710023732.69521832.926100
Fluctuatie48.06080925404244.28187411.224200
t0.5371515573410.04941110.871100


Multiple Linear Regression - Regression Statistics
Multiple R0.860048319537762
R-squared0.739683111939728
Adjusted R-squared0.733898292205056
F-TEST (value)127.866233671252
F-TEST (DF numerator)2
F-TEST (DF denominator)90
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation12.7786892091705
Sum Squared Residuals14696.5408114113


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
199.589.280188657578210.2198113424219
2101.689.817340214919611.7826597850804
3103.990.354491772260213.5455082277398
4106.690.891643329601315.7083566703987
5108.391.428794886942316.8712051130577
610291.965946444283210.0340535557168
793.892.50309800162431.29690199837574
891.693.0402495589653-1.44024955896526
997.793.57740111630624.12259888369375
1094.894.11455267364730.685447326352745
119894.65170423098833.34829576901175
12103.895.18885578832928.61114421167074
1397.895.72600734567032.07399265432974
1491.296.2631589030113-5.06315890301125
1589.396.8003104603523-7.50031046035226
1687.597.3374620176933-9.83746201769326
1790.497.8746135750343-7.47461357503425
1894.298.4117651323753-4.21176513237525
19102.298.94891668971633.25108331028375
20101.399.48606824705731.81393175294274
2196100.023219804398-4.02321980439826
2290.8100.560371361739-9.76037136173926
2393.2101.097522919080-7.89752291908026
2490.9101.634674476421-10.7346744764213
2591.1102.171826033762-11.0718260337623
2690.2102.708977591103-12.5089775911033
2794.3103.246129148444-8.94612914844427
2896103.783280705785-7.78328070578526
2999104.320432263126-5.32043226312626
30103.3104.857583820467-1.55758382046727
31113.1105.3947353778087.70526462219173
32112.8105.9318869351496.86811306485073
33112.1106.4690384924905.63096150750973
34107.4107.0061900498310.393809950168739
35111107.5433416071723.45665839282773
36110.5108.0804931645132.41950683548673
37110.8108.6176447218542.18235527814573
38112.4109.1547962791953.24520372080474
39111.5109.6919478365361.80805216346373
40116.2110.2290993938775.97090060612273
41122.5110.76625095121811.7337490487817
42121.3111.3034025085599.99659749144073
43113.9111.8405540659002.05944593409973
44110.7112.377705623241-1.67770562324127
45120.8112.9148571805827.88514281941772
46141.1161.512817991966-20.4128179919655
47147.4162.049969549306-14.6499695493065
48148162.587121106648-14.5871211066475
49158.1163.124272663989-5.02427266398852
50165163.6614242213291.33857577867049
51187164.19857577867122.8014242213295
52190.3164.73572733601225.5642726639885
53182.4165.27287889335317.1271211066475
54168.8165.8100304506942.9899695493065
55151.2166.347182008035-15.1471820080345
56120.1118.8235243113331.27647568866672
57112.5119.360675868674-6.86067586867428
58106.2119.897827426015-13.6978274260153
59107.1120.434978983356-13.3349789833563
60108.5120.972130540697-12.4721305406973
61106.5121.509282098038-15.0092820980383
62108.3122.046433655379-13.7464336553793
63125.6122.5835852127203.01641478727971
64124123.1207367700610.879263229938719
65127.2123.6578883274023.54211167259772
66136.9124.19503988474312.7049601152567
67135.8124.73219144208411.0678085579157
68124.3125.269342999425-0.969342999425287
69115.4125.806494556766-10.4064945567663
70113.6126.343646114107-12.7436461141073
71114.4126.880797671448-12.4807976714483
72118.4127.417949228789-9.01794922878928
73117127.955100786130-10.9551007861303
74116.5128.492252343471-11.9922523434713
75115.4129.029403900812-13.6294039008123
76113.6129.566555458153-15.9665554581533
77117.4130.103707015494-12.7037070154943
78116.9130.640858572835-13.7408585728353
79116.4131.178010130176-14.7780101301763
80111.1131.715161687517-20.6151616875173
81110.2132.252313244858-22.0523132448583
82118.9132.789464802199-13.8894648021993
83131.8133.326616359540-1.52661635954028
84130.6133.863767916881-3.2637679168813
85138.3134.4009194742223.89908052577772
86148.4134.93807103156313.4619289684367
87148.7135.47522258890413.2247774110957
88144.3136.0123741462458.28762585375472
89152.5136.54952570358615.9504742964137
90162.9137.08667726092725.8133227390727
91167.2137.62382881826829.5761711817317
92166.5138.16098037560928.3390196243907
93185.6138.69813193295046.9018680670497
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/1u0ve1197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/1u0ve1197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/26o1z1197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/26o1z1197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/3r0fq1197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/3r0fq1197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/4q5w91197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/4q5w91197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/5wh5c1197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/5wh5c1197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/6gck41197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/6gck41197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/7ut971197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/7ut971197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/892301197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/892301197729179.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/9l64h1197729179.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/15/t1197728218idhhl7efqfx2ruu/9l64h1197729179.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = Linear Trend ;
 
Parameters (R input):
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