Hi John/R-users,
- I have attached the data set in the mail in .txt format, can be read
using read.table(). Kindly let me know please if this is not sufficient.
- Also, to specify the modeling scheme I am stuck at:
1. Have numerical regressors GDP, HPA and FX to predict the variable Y
-- all these are quarterly time series.
2. Am looking to implement *Weighted Ridge regression* where the
observation weights (in SSE computation) are decreasing into the past at 5%
rate each quarter
3. Need to optimize wrt GCV criterion (leave K out scheme, K = 10% of
data size) to get the best lambda (Ridge parameter)
4. Then, for this optimum lambda, compute beta over the whole data as
[X'W'WX + Lambda * I]^-1 * X'W'WY (W'W is a diagonal
matrix with entries
decreasing at 5% from the last entry to the first, and preferably summing
upto 1 ]
Please let me know if anything is unclear, would be happy to elaborate. The
problem is I am very new to coding and although I know of some functions
that may be relevant (like lm.ridge), I am not being able to implement the
entire code myself.Appreciate your help.
Regards,
Preetam
On Tue, Sep 22, 2015 at 6:09 AM, John Kane <jrkrideau at inbox.com> wrote:
>
> No data.
>
> Please have a look at
>
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> and http://adv-r.had.co.nz/Reproducibility.html
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: lordpreetam at gmail.com
> > Sent: Tue, 22 Sep 2015 01:19:38 +0530
> > To: r-help at r-project.org
> > Subject: [R] Running GCV Optimization under Ridge Regression
> >
> > Hi guys,
> >
> > I am running Ridge regression on a dataset (predicted variable = y;
GDP,
> > HPA and FX are regressors). I found that lm.ridge() can perform the
ridge
> > regression given any value of lambda (i.e. the ridge parameter).
However,
> > in order to choose the best results, I need to select the model output
> > corresponding to that lambda which optimizes some logically defined
GCV
> > criteria. I thought there would be some in-built funcion in R Studio
for
> > this, but could not find one. Also, I am not being able to write the
> > required code for this. Any help here will be appreciated. I have
> > attached
> > the data in case it is required.
> >
> > Thanks,
> > Preetam
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> ____________________________________________________________
> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on
> your desktop!
> Check it out at http://www.inbox.com/marineaquarium
>
>
>
--
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division, C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.
-------------- next part --------------
T GDP Rate HPA FX Y
1 0.806660537 2.177803167 1.14980573 2.733594304
2 0.997724655 1.585686087 0.814496976 3.193948056
3 0.99032353 0.569843997 0.464488882 3.065751781
4 0.606121306 3.037648988 0.565322084 4.537399052
5 0.858131141 4.816423605 1.924534222 7.871730873
6 0.052909178 2.048591352 1.470221953 2.580646078
7 0.081400487 1.152495559 1.128828557 7.200336313
8 0.840972911 3.848225962 1.004272646 1.211124673
9 0.965868218 1.039679934 0.231408747 7.566968
10 0.952626722 4.455565591 0.483541015 9.412639513
11 0.067691757 0.038417569 0.69744243 8.055369029
12 0.985658841 1.143481763 1.65850909 6.962599601
13 0.177186946 3.762691635 0.44379572 9.904367023
14 0.490066697 0.655629739 1.281478696 1.796422139
15 0.223740666 1.393201062 1.235291827 5.237943945
16 0.782873809 1.485727273 0.224511215 6.399036418
17 0.947492758 0.318485005 1.158911495 8.183470692
18 0.49692711 2.169601457 1.777618832 8.830805294
19 0.956704273 1.546827505 0.241838792 7.554654431
20 0.404624372 3.041530693 1.66039172 6.709330773
21 0.98557461 2.45656369 1.695179666 8.638707974
22 0.494102398 4.527230971 0.993352283 7.958872374
23 0.893182943 3.429112971 0.675541115 5.665249801
24 0.669680459 0.459919029 1.011872328 8.883120607
25 0.017296599 2.184045646 1.575891106 2.585709635