Displaying 20 results from an estimated 90000 matches similar to: "Cross-validation question"
2001 Mar 07
1
cross-validation
The function crossval (in library bootstrap)
works well for the first degree polynomial model,
but in the case of the second degree model I got
an error message (see below).
I would be very greatfull if somebody could
give some advices for the following:
> library(bootstrap)
>
> x<-c(22,23.4,24.9,28.5,29.8,31.6,34.2,36.4,37.7,39)
>
2003 Nov 03
1
svm in e1071 package: polynomial vs linear kernel
I am trying to understand what is the difference between linear and
polynomial kernel:
linear: u'*v
polynomial: (gamma*u'*v + coef0)^degree
It would seem that polynomial kernel with gamma = 1; coef0 = 0 and degree
= 1
should be identical to linear kernel, however it gives me significantly
different results for very simple
data set, with linear kernel
2012 Feb 08
1
Fitting polynomial (power greater than 2)
Hey all, first time poster here. I'm new to R and working on my first real
programming and forecasting asignment. I'm using unemployment data from
1948-2012. I successfully completed part a and the linear fit for part b,
but i am really struggling fitting a polynomial with a power greater than 2
to my forecast. I'll upload my R code at the bottom. Any help is very much
appreciated!
2010 Jan 21
3
cross validation function translated from stata
Hi, everyone:
I ask for help about translating a stata program into R.
The program perform cross validation as it stated.
#1. Randomly divide the data set into 10 sets of equal size, ensuring equal
numbers of events in each set
#2. Fit the model leaving out the 1st set
#3. Apply the fitted model in (2) to the 1st set to obtain the predicted
probability of a prostate cancer diagnosis.
#4. Repeat
2011 Jun 20
2
Error of Cross Validation
Dear R users:
Recently, I tried to write a program to calculate cross-validated predicted
value.
My sources are as follows. However, the R reported an error.
Could you please check the sources? Thanks.
set.seed(100)
x<-rnorm(100)
y<-sample(rep(0:1,50),replace=T)
dat<-data.frame(x,y)
library(rms)
fito<-lrm(y~x)
preo<-predict(fito)
pre<-matrix(NA,nrow=100,ncol=200)
for (i in
2017 Jul 13
0
Quadratic function with interaction terms for the PLS fitting model?
> On Jul 12, 2017, at 6:58 PM, Ng, Kelvin Sai-cheong <kscng at connect.hku.hk> wrote:
>
> Dear all,
>
> I am using the pls package of R to perform partial least square on a set of
> multivariate data. Instead of fitting a linear model, I want to fit my
> data with a quadratic function with interaction terms. But I am not sure
> how. I will use an example to
2013 Jan 15
0
e1071 SVM, cross-validation and overfitting
I am accustomed to the LIBSVM package, which provides cross-validation
on training with the -v option
% svm-train -v 5 ...
This does 5 fold cross validation while building the model and avoids
over-fitting.
But I don't see how to accomplish that in the e1071 package. (I
learned that svm(... cross=5 ...) only _tests_ using cross-validation
-- it doesn't affect the training.) Can
2017 Jul 16
0
How to formulate quadratic function with interaction terms for the PLS fitting model?
??
If I haven't misunderstood, they are completely different!
1) NIR must be a matrix, or poly(NIR,...) will fail.
2) Due to the previously identified bug in poly, degree must be
explicitly given as poly(NIR, degree =2,raw = TRUE).
Now consider the following example:
> df <-matrix(runif(60),ncol=3)
> y <- runif(20)
> mdl1 <-lm(y~df*I(df^2))
> mdl2
2009 Jun 14
1
Leave One Out Cross Validation
Hi All,
I have been trying to get this LOO-Cross Validation method to work on R for
the past 3 weeks but have had no luck. I am hoping someone would kindly help
me.
Essentially I want to code the LOO-Cross Validation for the 'Local Constant'
and 'Local Linear' constant estimators. I want to find optimal h, bandwidth.
Thank you very much!
-M
--
View this message in context:
2012 Dec 02
1
e1071 SVM: Cross-validation error confusion matrix
Hi,
I ran two svm models in R e1071 package: the first without cross-validation
and the second with 10-fold cross-validation.
I used the following syntax:
#Model 1: Without cross-validation:
> svm.model <- svm(Response ~ ., data=data.df, type="C-classification",
> kernel="linear", cost=1)
> predict <- fitted(svm.model)
> cm <- table(predict,
2012 Mar 02
1
e1071 SVM: Cross-validation error confusion matrix
Hi,
I ran two svm models in R e1071 package: the first without cross-validation
and the second with 10-fold cross-validation.
I used the following syntax:
#Model 1: Without cross-validation:
> svm.model <- svm(Response ~ ., data=data.df, type="C-classification",
> kernel="linear", cost=1)
> predict <- fitted(svm.model)
> cm <- table(predict,
2010 Jun 07
1
fit data with y = x^-1
Dear list,
I am getting weired with fitting data with a 1/x-polynomial. Suggest I have
the following data:
x <- c(1,2,3,4,5,6,7)
y <- c(100,20,4,2,1,.3,.1)
I may fit this with a linear model
fit1 = lm(y ~ I(x))
Getting plot out of this model I applied
library(polynom)
pol1 = polynomial(fit1$coefficients)
f1 = as.function(pol1)
plot(x,y)
lines(x, f1(x), col = 2)
Clearly, this model
2008 Jan 10
1
leave one out cross validation
Hi
I am trying to validate my regression results using the leave one out crosss
validation method. Is any script available in R to use this method for a
linear regression equation?
Both R or SPLUS would do. any clues on how to write the script will also
help.
Thanks a lot,
A
[[alternative HTML version deleted]]
2017 Jul 13
0
How to formulate quadratic function with interaction terms for the PLS fitting model?
Below.
-- Bert
Bert Gunter
On Thu, Jul 13, 2017 at 3:07 AM, Luigi Biagini <luigi.biagini at gmail.com> wrote:
> I have two ideas about it.
>
> 1-
> i) Entering variables in quadratic form is done with the command I
> (variable ^ 2) -
> plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation =
> "LOO"
> You could also use a new variable
2007 May 11
1
model seleciton by leave-one-out cross-validation
Hi, all
When I am using mle.cv(wle), I find a interesting problem: I can't do
leave-one-out cross-validation with mle.cv(wle). I will illustrate the
problem as following:
> xx=matrix(rnorm(20*3),ncol=3)
> bb=c(1,2,0)
> yy=xx%*%bb+rnorm(20,0,0.001)+0
> summary(mle.cv(yy~xx,split=nrow(xx)-1,monte.carlo=2*nrow(xx),verbose=T),
num.max=1)[[1]]
mle.cv: dimension of the split subsample
2009 May 26
0
cross-validation in rpart
Dear R users,
I know cross-validation does not work in rpart with user defined split
functions. As Terry Therneau suggested, one can use the xpred.rpart function
and then summarize the matrix of the predicted values into a single
"goodness" value.
I need only a confirmation: set for example xval=10, if I correctly
understood a single column of the matrix obatined by xpred.rpart gives
2010 Oct 22
1
cv.lm() broken; cross validation vs. predict(interval="prediction")
<< repost because previous attempt was not plain text, sorry! >>
Hi Folks,
I have a pretty simple problem: after building a multivariate linear model,
I need to report my 95% confidence interval for predictions based on future
observations.
I know that one option is to use predict(interval="prediction") but
I'm curious about less parametric ways to get an estimate.
I
2017 Jul 13
0
Quadratic function with interaction terms for the PLS fitting model?
Hi Bert,
Ok, to your initial point, the key nuance is that if 'x' is a vector, you can leave the 'degree' argument unnamed, however, if 'x' is a matrix, you cannot. That aspect of the behavior does not seem to change if poly() is called stand alone or, as suggested in ?poly, within a formula to be parsed.
Working on tracing through the code using debug(), the error is
2017 Jul 13
0
Quadratic function with interaction terms for the PLS fitting model?
> On Jul 13, 2017, at 10:43 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>
> poly(NIR, degree = 2) will work if NIR is a matrix, not a data.frame.
> The degree argument apparently *must* be explicitly named if NIR is
> not a numeric vector. AFAICS, this is unclear or unstated in ?poly.
I still get the same error with:
library(pld)
data(gasoline)
gasTrain <-
2007 Jan 28
3
Inverse fuction of ecdf
Hi Everyone,
I want to generate some random numbers according to some empirical
distribution. Therefore I am looking for the inverse of an empirical
cumulative distribution function. I haven't found any in R. Can anyone
give a pointer?
Thanks,
Geoffrey
_______________________________________________________=0A=
=0A=
=0A=
The information in this email or in any file attached