Message-ID: <200901141051.n0EApAwk006731@hypatia.math.ethz.ch>
Date: 2009-01-14T10:50:43Z
From: Gerard M. Keogh
Subject: inter-timeseries correlation or corrections
In-Reply-To: <gkj47u$qdq$1@ger.gmane.org>
Tim,
Given you have so little data - I would try
a) prefilter and forecast
Fit a fairly simple ARIMA(0,1,1) model to A and treat 8987 as an outlier -
then predict the fitted series AF with the 3 missing points as forecasts.
Fit another ARIMA(0,1,1) with 7688 as an outlier - then back cast to fill
in past values and use the fitted series BF.
The fitted series AF and BF series are the filtered estimates
Then
b)
Regress BF on AF at time t, i.e use
BF_t = alpha * AF_t + Intercept + error_t
then predict BF_hat = alpha1_hat * AF + Intercept.
Regress AF on BF at time t, i.e use
then predict AF_hat = alpha2_hat * BF + Intercept.
And use these predictions as my (first approx) to the missing values.
Hope this helps!
Gerard
Tim Michelsen
<timmichelsen at gmx
-topmail.de> To
Sent by: r-help at stat.math.ethz.ch
r-help-bounces at r- cc
project.org
Subject
Re: [R] inter-timeseries
13/01/2009 22:22 correlation or corrections
Dear R-Users,
I put a small sample data set and script.
Aim: combine two partly overlapping series to one by prediction.
Problem: only overlapping data points are predicted.
Question: How do I predict data for rows 1-9 and 14-16?
Thanks in advance for your advince,
Tim
### CODE ###
x <- read.csv('Buch1.csv')
x
year A B
1 1960 2 NA
2 1961 3 NA
3 1962 4 NA
4 1963 54 NA
5 1964 3 NA
6 1965 324 NA
7 1966 546 NA
8 1967 455 NA
9 1968 456 NA
10 1969 456 67
11 1970 8987 34
12 1971 78 34
13 1972 65 3
14 1973 NA 123
15 1974 NA 7688
16 1975 NA 324
predict(lm(a~b))
10 11 12 13
2527.198 2394.489 2394.489 2269.824
### DATA ###
year,A,B
1960,2,
1961,3,
1962,4,
1963,54,
1964,3,
1965,324,
1966,546,
1967,455,
1968,456,
1969,456,67
1970,8987,34
1971,78,34
1972,65,3
1973,,123
1974,,7688
1975,,324
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
**********************************************************************************
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. It is the policy of the Department of Justice, Equality and Law Reform and the Agencies and Offices using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive you should contact the sender immediately and also mailminder[at]justice.ie.
Is le haghaidh an duine n? an eintitis ar a bhfuil s? d?rithe, agus le haghaidh an duine n? an eintitis sin amh?in, a bhearta?tear an fhaisn?is a tarchuireadh agus f?adfaidh s? go bhfuil ?bhar faoi r?n agus/n? faoi phribhl?id inti. Toirmisctear aon athbhreithni?, atarchur n? leathadh a dh?anamh ar an bhfaisn?is seo, aon ?s?id eile a bhaint aisti n? aon ghn?omh a dh?anamh ar a hiontaoibh, ag daoine n? ag eintitis seachas an faighteoir beartaithe. M? fuair t? ? seo tr? dhearmad, t?igh i dteagmh?il leis an seolt?ir, le do thoil, agus scrios an t-?bhar as aon r?omhaire. Is ? beartas na Roinne Dl? agus Cirt, Comhionannais agus Athch?irithe Dl?, agus na nOif?g? agus na nGn?omhaireachta? a ?s?ideann seirbh?s? TF na Roinne, seoladh ?bhair chol?il a dh?chead?.
M?s rud ? go measann t? gur ?bhar col?il at? san ?bhar at? sa teachtaireacht seo is ceart duit dul i dteagmh?il leis an seolt?ir l?ithreach agus le mailminder[ag]justice.ie chomh maith.
***********************************************************************************