Displaying 20 results from an estimated 500 matches similar to: "running crossvalidation many times MSE for Lasso regression"
2023 Oct 22
2
running crossvalidation many times MSE for Lasso regression
No error message shown Please include the error message so that it is
not necessary to rerun your code. This might enable someone to see the
problem without running the code (e.g. downloading packages, etc.)
-- Bert
On Sun, Oct 22, 2023 at 1:36?PM varin sacha via R-help
<r-help at r-project.org> wrote:
>
> Dear R-experts,
>
> Here below my R code with an error message. Can
2023 Oct 24
1
running crossvalidation many times MSE for Lasso regression
?s 20:12 de 23/10/2023, varin sacha via R-help escreveu:
> Dear R-experts,
>
> I really thank you all a lot for your responses. So, here is the error (and warning) messages at the end of my R code.
>
> Many thanks for your help.
>
>
> Error in UseMethod("predict") :
> ? no applicable method for 'predict' applied to an object of class
2023 Oct 23
1
running crossvalidation many times MSE for Lasso regression
Dear R-experts,
I really thank you all a lot for your responses. So, here is the error (and warning) messages at the end of my R code.
Many thanks for your help.
Error in UseMethod("predict") :
? no applicable method for 'predict' applied to an object of class "c('matrix', 'array', 'double', 'numeric')"
> mean(unlist(lst))
[1] NA
2023 Oct 23
2
running crossvalidation many times MSE for Lasso regression
For what it's worth it looks like spm2 is specifically for *spatial*
predictive modeling; presumably its version of CV is doing something
spatially aware.
I agree that glmnet is old and reliable. One might want to use a
tidymodels wrapper to create pipelines where you can more easily switch
among predictive algorithms (see the `parsnip` package), but otherwise
sticking to glmnet
2018 May 22
2
Bootstrap and average median squared error
I forgot, you should also set.seed() before calling boot() to make the
results reproducible.
Rui Barradas
On 5/22/2018 10:00 AM, Rui Barradas wrote:
> Hello,
>
> If you want to bootstrap a statistic, I suggest you use base package boot.
> You would need the data in a data.frame, see how you could do it.
>
>
> library(boot)
>
> bootMedianSE <- function(data,
2018 May 22
1
Bootstrap and average median squared error
Hello,
Right!
I copied from the OP's question without thinking about it.
Corrected would be
bootMedianSE <- function(data, indices){
d <- data[indices, ]
fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d)
ypred <- predict(fit)
y <- d$crp
median((y - ypred)^2)
}
Sorry,
rui Barradas
On 5/22/2018 11:32 AM, Daniel Nordlund wrote:
> On 5/22/2018
2018 May 22
0
Bootstrap and average median squared error
On 5/22/2018 2:32 AM, Rui Barradas wrote:
> bootMedianSE <- function(data, indices){
> ???? d <- data[indices, ]
> ???? fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d)
> ???? ypred <- predict(fit)
> ???? y <- d$crp
> ???? median(y - ypred)^2
> }
since the OP is looking for the "median squared error", shouldn't the
final line of the
2011 Sep 23
1
Adding weights to optim
I realize this may be more of a math question. I have the following optim:
optim(c(0.0,1.0),logis.op,x=d1_all$SOA,y=as.numeric(md1[,i]))
which uses the following function:
logis.op <- function(p,x,y) {
ypred <- 1.0 / (1.0 + exp((p[1] - x) / p[2]));
res <- sum((y-ypred)^2)
return(res)
}
I would like to add weights to the optim. Do I have to alter the logis.op
function by
2018 May 22
0
Bootstrap and average median squared error
Hello,
If you want to bootstrap a statistic, I suggest you use base package boot.
You would need the data in a data.frame, see how you could do it.
library(boot)
bootMedianSE <- function(data, indices){
d <- data[indices, ]
fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d)
ypred <- predict(fit)
y <- d$crp
median(y - ypred)^2
}
dat <-
2018 May 21
2
Bootstrap and average median squared error
Dear R-experts,
I am trying to bootstrap (and average) the median squared error evaluation metric for a robust regression. I can't get it. What is going wrong ?
Here is the reproducible example.
#############################
install.packages( "quantreg" )
library(quantreg)
crp <-c(12,14,13,24,25,34,45,56,25,34,47,44,35,24,53,44,55,46,36,67)
bmi
2008 Nov 26
1
Smoothed 3D plots
DeaR list,
I'm trying to represent some information via 3D plots. My data and session
info are at the end of this message. So far, I have tried scatterplot3d
(scatterplot3d),
persp3d (rgl), persp (graphics) and scatter3d (Rmcdr) but any of them gave
me what I'd like to have as final result (please see [1] for a similar 3D
plot changing
PF by ypred, pdn by h4 and pup by h11).
In general
2006 Apr 05
1
predict.smooth.spline.fit and Recall() (Was: Re: Return function from function and Recall())
Hi,
forget about the below details. It is not related to the fact that
the function is returned from a function. Sorry about that. I've
been troubleshooting soo much I've been shoting over the target. Here
is a much smaller reproducible example:
x <- 1:10
y <- 1:10 + rnorm(length(x))
sp <- smooth.spline(x=x, y=y)
ypred <- predict(sp$fit, x)
# [1] 2.325181 2.756166 ...
2011 Jan 27
2
Extrapolating values from a glm fit
Dear R-help,
I have fitted a glm logistic function to dichotomous forced choices
responses varying according to time interval between two stimulus. x values
are time separation in miliseconds, and the y values are proportion
responses for one of the stimulus. Now I am trying to extrapolate x values
for the y value (proportion) at .25, .5, and .75. I have tried several
predict parameters, and they
2012 Feb 25
1
Unexpected behavior in factor level ordering
Hello, Everybody:
This may not be a "bug", but for me it is an unexpected outcome. A
factor variable's levels
do not retain their ordering after the levels function is used. I
supply an example in which
a factor with values "BC" "AD" (in that order) is unintentionally
re-alphabetized by the levels
function.
To me, this is very bad behavior. Would you agree?
#
2006 Aug 10
1
logistic discrimination: which chance performance??
Hello,
I am using logistic discriminant analysis to check whether a known
classification Yobs can be predicted by few continuous variables X.
What I do is to predict class probabilities with multinom() in nnet(),
obtaining a predicted classification Ypred and then compute the percentage
P(obs) of objects classified the same in Yobs and Ypred.
My problem now is to figure out whether P(obs) is
2010 Jun 04
0
glmpath crossvalidation
Hi all,
I'm relatively new to using R, and have been trying to fit an L1
regularization path using coxpath from the glmpath library.
I'm interested in using a cross validation framework, where I crossvalidate
on a training set to select the lambda that achieves the lowest error, then
use that value of lambda on the entire training set, before applying to a
test set. This seems to entail
2006 Feb 02
0
crossvalidation in svm regression in e1071 gives incorrect results (PR#8554)
Full_Name: Noel O'Boyle
Version: 2.1.0
OS: Debian GNU/Linux Sarge
Submission from: (NULL) (131.111.8.96)
(1) Description of error
The 10-fold CV option for the svm function in e1071 appears to give incorrect
results for the rmse.
The example code in (3) uses the example regression data in the svm
documentation. The rmse for internal prediction is 0.24. It is expected the
10-fold CV rmse
2006 Feb 02
0
crossvalidation in svm regression in e1071 gives incorre ct results (PR#8554)
1. This is _not_ a bug in R itself. Please don't use R's bug reporting
system for contributed packages.
2. This is _not_ a bug in svm() in `e1071'. I believe you forgot to take
sqrt.
3. You really should use the `tot.MSE' component rather than the mean of
the `MSE' component, but this is only a very small difference.
So, instead of spread[i] <- mean(mysvm$MSE), you
2018 Apr 21
0
Cross-validation : can't get the predicted response on the testing data
Dear R-experts,
Doing cross-validation for 2 robust regressions (HBR and fast Tau). I can't get the 2 errors rates (RMSE and MAPE). The problem is to predict the response on the testing data. I get 2 error messages.
Here below the reproducible (fictional example) R code.
#install.packages("MLmetrics")
# install.packages( "robustbase" )
# install.packages(
2008 Jun 09
1
Cross-validation in R
Folks; I am having a problem with the cv.glm and would appreciate someone
shedding some light here. It seems obvious but I cannot get it. I did read
the manual, but I could not get more insight. This is a database containing
3363 records and I am trying a cross-validation to understand the process.
When using the cv.glm, code below, I get mean of perr1 of 0.2336 and SD of
0.000139. When using a