Displaying 20 results from an estimated 400 matches similar to: "Selecting ridge regression coefficients for minimum GCV"
2013 Apr 26
1
Regression coefficients
Hi all,
I have run a ridge regression as follows:
reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$g+final$u,
lambda=seq(0,10,0.01))
Then I enter :
select(reg)   and it returns: modified HKB estimator is 19.3409
                                       modified L-W estimator is 36.18617
                                       smallest value of GCV  at 10
I think it means that it is
2013 Apr 30
0
Ridge regression
Hi all,
I have run a ridge regression on a data set 'final' as follows:
reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u,
lambda=seq(0,10,0.01))
Then I enter :
select(reg)   and it returns: modified HKB estimator is 19.3409
                                       modified L-W estimator is 36.18617
                                       smallest value of GCV  at 10
I think it
2002 Jun 20
1
Possible bug with glm.nb and starting values (PR#1695)
Full_Name: Ben Cooper
Version: 1.5.0
OS: linux
Submission from: (NULL) (134.174.187.90)
The help page for glm.nb (in MASS package) says that it takes "Any other
arguments for the glm() function except family"
One such argument is   start   "starting values for the parameters in the linear
predictor."
However, when called with starting values glm.nb returns:
   Error in
2012 Feb 03
1
A question on Unit Root Test using "urca" toolbox
Hello,
   I have a question on unit root test with urca toolbox.
   First, to run a unit root test with lags selected by BIC, I type:
> CPILD4UR<-ur.df(x1$CPILD4[5:nr1], type ="drift", lags=12, selectlags ="BIC")
> summary(CPILD4UR)
   The results indicate that the optimal lags selected by BIC is 4.
   Then I run the same unit root test with drift and 4 lags:
2008 May 22
1
How to account for autoregressive terms?
Hi,
how to estimate a the following model in R:
y(t)=beta0+beta1*x1(t)+beta2*x2(t)+...+beta5*x5(t)+beta6*y(t-1)+beta7*y(t-2)+beta8*y(t-3)
1) using "lm" :
dates <- as.Date(data.df[,1])
selection<-which(dates>=as.Date("1986-1-1") & dates<=as.Date("2007-12-31"))
dep <- ts(data.df[selection,c("dep")])
indep.ret1
2012 Dec 03
2
How to rename the columns of as.table
Hello guys .. I would like to have some help about as.table .
I made a table with the autocorrelations of the returns whit 10 lags and i
get this :
autocorrelazione2 <- as.table(c((cor(r2[-1151,],lag(r2))),(cor(r2[-
c(1151,1150),],lag(r2, k=2))),(cor(r2[- c(1151,1150,1149),],lag(r2,
k=3))),(cor(r2[- c(1151,1150,1149,1148),],lag(r2, k=4))),(cor(r2[-
c(1151,1150,1149,1148,1147),],lag(r2,
2012 Mar 19
1
Lag based on Date objects with non-consecutive values
Hello all,
I need to figure out a way to lag a variable in by a number of days
without using the zoo package. I need to use a remote R connection
that doesn't have the zoo package installed and is unwilling to do so.
So that is, I want a function where I can specify the number of days
to lag a variable against a Date formatted column. That is relatively
easy to do. The problem arises when I
2008 Jan 31
1
Feature request: about lag(), which.min() and cat().
Hello
I'm only user of R and have many little knowledge in programming but I 
permit to send you some whishes/suggestions for R.
which.min
like which(), which.min() should also include an argument arr.ind. Note 
that one can have it with which(a==min(a), arr.ind=TRUE) but if there is 
a reason to build a special function which.min, why not add also this 
nice argument?
lag()
If one wants to
1999 May 06
0
image weirdness
I am using R 63.0.
Now let's try this simple image plot.
Here is the data file:
============================
lag1 lag2 cif2d
1 1 11
1 2 12
1 3 13
2 1 21
2 2 22
2 3 23
3 1 31
3 2 32
3 3 33
====================
data<-read.table("~/r/rt/data/unif/junk.out",header=TRUE)
x<-unique(data$lag1)
y<-unique(data$lag2)
z<-matrix(data$cif2d,length(y),length(x))
At this point, see
1999 May 06
0
matrix weirdness
I am using R on unix version 63.0
I am doing an image plot of the following data file:
================================
lag1  lag2   cif2d
0.000 0.000     NaN
0.000 1.000 0.500000
0.000 2.000 0.489831
0.000 3.000 0.492986
0.000 4.000 0.493409
0.000 5.000 0.492727
0.000 6.000 0.494485
1.000 0.000 0.500000
1.000 1.000     NaN
1.000 2.000 0.495098
1.000 3.000 0.489831
1.000 4.000 0.492986
1.000 5.000
2008 Aug 11
3
Peoblem with nls and try
Hello,
I can`t figure out how can increase the velocity of the fitting data by nls.
I have a long data .csv
I want to read evry time the first colunm to the other colunm and analisy with thata tools
setwd("C:/dati")
a<-read.table("Normalizzazione.csv", sep=",", dec=".", header=F)
for (i in 1:dim(a[[2]]]) {
#preparazione dati da analizzare
2011 Nov 30
2
forecasting linear regression from lagged variable
I'm currently working with some time series data with the xts package, and
would like to generate a forecast 12 periods into the future. There are
limited observations, so I am unable to use an ARIMA model for the forecast.
Here's the regression setup, after converting everything from zoo objects to
vectors.
hire.total.lag1 <- lag(hire.total, lag=-1, na.pad=TRUE)
lm.model <-
2023 Jan 16
1
(no subject)
Dear Members,
Greetings! I would like to know how to create the lag variable for my data.
# Load data and create time series object ----
oil <- read_xlsx("crudefinal.xlsx")
pricet=ts(oil$price, start = c(2020, 22), frequency = 365)
roilt=ts(diff(log(oil$price))*100,start=c(2020,22),freq=365)
# Fit MSW model ----
roilt.lag0 =
2007 Jul 12
2
lead
Hi,
 
is there any function in R that shifts elements of a vector to the
opposite direction of what Lag()  of the Hmisc package does? (something
like, Lag(x, shift = -1) )
 
Thanks
 
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
2004 Oct 29
2
lag variable addition to data frame question
Hi,
I was wondering if there is a more efficient way of handling the following method of creating a lagged value in a data frame without using the recursive 
'for(i in 1:n)' loop and without using as.ts
#Steps to creating a lag variable in a data frame 'my.dat.fr'
# with 275 columns, 2400 rows of numbers and factors . The #variable x is a factor of #with five different levels
the
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a
time-series. How do we correctly create a lagged value of the
time-series variable?
As an example, suppose I create:
  A <- data.frame(year=rep(c(1980:1984),3),
                  person= factor(sort(rep(1:3,5))),
                  wage=c(rnorm(15)))
  > A
     year person        wage
  1  1980      1  0.17923212
  2  1981     
1999 May 06
1
x,y vs row,column
I think my problems are coused by a fundamental R incompatibility in how
matrices are stored and the usual way of specifying Cartesian coordinates.
When I do
data<-read.table("~/r/rt/data/unif/6cbcif2d.out",header=TRUE)
x<-unique(data$lag1)
y<-unique(data$lag2)
z<-matrix(data$cif2d,length(y),length(x))
This z matrix is printed apparently correctly from a Cartesian point of
2018 Mar 25
3
Take average of previous weeks
Dear all,
I have weekly data by city (variable citycode). I would like to take the
average of the previous two, three, four weeks (without the current week)
of the variable called value.
This is what I have tried to compute the average of the two previous weeks;
df = df %>%
  mutate(value.lag1 = lag(value, n = 1)) %>%
  mutate(value .2.previous = rollapply(data = value.lag1,
             
2009 Jun 04
0
help needed with ridge regression and choice of lambda with lm.ridge!!!
Hi,
I'm a beginner in the field, I have to perform the ridge regression with lm.ridge for many datasets, and I wanted to do it in an automatic way.
In which way I can automatically choose lambda ?
As said, right now I'm using lm.ridge MASS function, which I found quite simple and fast, and I've seen that among the returned values there are HKB estimate of the ridge constant and L-W
2018 Mar 25
0
Take average of previous weeks
I am sure that this sort of thing has been asked and answered before,
so in case my suggestions don't work for you, just search the archives
a bit more.
I am also sure that it can be handled directly by numerous functions
in numerous packages, e.g. via time series methods or by calculating
running means of suitably shifted series.
However, as it seems to be a straightforward task, I'll