[R] inter-timeseries correlation or corrections
Gerard M. Keogh
GMKeogh at justice.ie
Wed Jan 14 11:50:43 CET 2009
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.
***********************************************************************************
More information about the R-help
mailing list