Home » date » 2008 » Jan » 06 » attachments

s

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sun, 06 Jan 2008 10:15:46 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00.htm/, Retrieved Sun, 06 Jan 2008 18:15:34 +0100
 
User-defined keywords:
diesel verklaren door inflatie
 
Dataseries X:
» Textbox « » Textfile « » CSV «
0.73 1.79 0.74 1.95 0.75 2.26 0.74 2.04 0.76 2.16 0.76 2.75 0.78 2.79 0.79 2.88 0.89 3.36 0.88 2.97 0.88 3.1 0.84 2.49 0.76 2.2 0.77 2.25 0.76 2.09 0.77 2.79 0.78 3.14 0.79 2.93 0.78 2.65 0.76 2.67 0.78 2.26 0.76 2.35 0.74 2.13 0.73 2.18 0.72 2.9 0.71 2.63 0.73 2.67 0.75 1.81 0.75 1.33 0.72 0.88 0.72 1.28 0.72 1.26 0.74 1.26 0.78 1.29 0.74 1.1 0.74 1.37 0.75 1.21 0.78 1.74 0.81 1.76 0.75 1.48 0.7 1.04 0.71 1.62 0.71 1.49 0.73 1.79 0.74 1.8 0.74 1.58 0.75 1.86 0.74 1.74 0.74 1.59 0.73 1.26 0.76 1.13 0.8 1.92 0.83 2.61 0.81 2.26 0.83 2.41 0.88 2.26 0.89 2.03 0.93 2.86 0.91 2.55 0.9 2.27 0.86 2.26 0.88 2.57 0.93 3.07 0.98 2.76 0.97 2.51 1.03 2.87 1.06 3.14 1.06 3.11 1.08 3.16 1.09 2.47 1.04 2.57 1 2.89
 
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 time5 seconds
R Server'George Udny Yule' @ 72.249.76.132


Multiple Linear Regression - Estimated Regression Equation
dsl[t] = + 0.596610740118349 + 0.098248900453546`inf `[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)0.5966107401183490.03505517.019200
`inf `0.0982489004535460.0153856.385900


Multiple Linear Regression - Regression Statistics
Multiple R0.60672287067846
R-squared0.368112641804311
Adjusted R-squared0.359085679544373
F-TEST (value)40.7792379323432
F-TEST (DF numerator)1
F-TEST (DF denominator)70
p-value1.61221743733009e-08
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.0825879693636396
Sum Squared Residuals0.477454087852663


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
10.730.772476271930194-0.0424762719301944
20.740.788196096002764-0.0481960960027644
30.750.818653255143363-0.0686532551433633
40.740.797038497043583-0.0570384970435832
50.760.808828365098009-0.0488283650980087
60.760.8667952163656-0.106795216365601
70.780.870725172383743-0.0907251723837427
80.790.879567573424562-0.0895675734245618
90.890.926727045642264-0.0367270456422639
100.880.888409974465381-0.00840997446538102
110.880.901182331524342-0.0211823315243420
120.840.84125050224768-0.00125050224767895
130.760.81275832111615-0.0527583211161506
140.770.817670766138828-0.0476707661388278
150.760.80195094206626-0.0419509420662605
160.770.870725172383743-0.100725172383743
170.780.905112287542484-0.125112287542484
180.790.884480018447239-0.094480018447239
190.780.856970326320246-0.0769703263202462
200.760.858935304329317-0.0989353043293172
210.780.818653255143363-0.0386532551433633
220.760.827495656184182-0.0674956561841824
230.740.805880898084402-0.0658808980844023
240.730.81079334310708-0.0807933431070797
250.720.881532551433633-0.161532551433633
260.710.855005348311175-0.145005348311175
270.730.858935304329317-0.128935304329317
280.750.774441249939268-0.0244412499392676
290.750.7272817777215660.0227182222784345
300.720.683069772517470.0369302274825302
310.720.722369332698888-0.00236933269888824
320.720.720404354689817-0.000404354689817324
330.740.7204043546898170.0195956453101827
340.780.7233518217034240.0566481782965764
350.740.704684530617250.0353154693827501
360.740.7312117337397070.00878826626029263
370.750.715491909667140.03450809033286
380.780.767563826907520.0124361730924806
390.810.769528804916590.0404711950834098
400.750.7420191127895970.00798088721040259
410.70.6987895965900370.0012104034099628
420.710.755773958853094-0.0457739588530939
430.710.743001601794133-0.0330016017941329
440.730.772476271930197-0.0424762719301967
450.740.773458760934732-0.0334587609347321
460.740.751844002834952-0.0118440028349520
470.750.779353694961945-0.0293536949619449
480.740.76756382690752-0.0275638269075194
490.740.752826491839487-0.0128264918394875
500.730.7204043546898170.00959564531018268
510.760.7076319976308560.0523680023691437
520.80.7852486289891580.0147513710108424
530.830.853040370302104-0.0230403703021044
540.810.818653255143363-0.00865325514336324
550.830.833390590211395-0.00339059021139527
560.880.8186532551433630.0613467448566367
570.890.7960560080390480.0939439919609523
580.930.877602595415490.0523974045845091
590.910.8471454362748920.0628545637251084
600.90.8196357441478990.0803642558521012
610.860.8186532551433630.0413467448566367
620.880.8491104142839630.0308895857160374
630.930.8982348645107360.0317651354892645
640.980.8677777053701360.112222294629864
650.970.843215480256750.126784519743250
661.030.8785850844200260.151414915579974
671.060.9051122875424840.154887712457516
681.060.9021648205288770.157835179471123
691.080.9070772655515550.172922734448445
701.090.8392855242386080.250714475761392
711.040.8491104142839630.190889585716037
7210.8805500624290970.119449937570903
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/1jdy91199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/1jdy91199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/20jsy1199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/20jsy1199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/3lsld1199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/3lsld1199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/4n2b11199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/4n2b11199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/5iotk1199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/5iotk1199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/6g4x61199639739.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/6g4x61199639739.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/72l201199639740.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/72l201199639740.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/8azwt1199639740.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/8azwt1199639740.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/9vv0r1199639740.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/06/t1199639724qregpshh5mwzc00/9vv0r1199639740.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 = 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:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

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