Displaying 20 results from an estimated 6000 matches similar to: "How to do leave-n-out cross validation in R?"
2008 Nov 14
0
Cross-validation
Hi,
I was trying to do cross-validation using the crossval function (bootstrap package), with the following code:
---------------------------------------------------------------------------------------------------------
theta.fit <- function(x,y){
model <- svm(x,y,kernel = "linear")
}
theta.predict <- function(fit,x){
prediction <- predict(fit,x)
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 Apr 25
2
Apparent namespace problem
I'm seeing some strange behavior while using the snow package for
networked computers. I believe it's caused by name space resolution
issues, and would appreciate any suggestions tracking it down.
First, is there a way to find out what frame (as in frames in
environments, not data frames) a name is being obtained from or put
into?
Second, how closely does the evaluation environment in
2005 May 12
1
pls -- crossval vs plsr(..., CV=TRUE)
Hi,
Newbie question about the pls package.
Setup:
Mac OS 10.3.9
R: Aqua GUI 1.01, v 2.0.1
I want to get R^2 and Q^2 (LOO and Leave-10-Out) values for each
component for my model.
I was running into a few problems so I played with the example a little
and the results do not match up with the comments
in the help pages.
$ library(pls)
$ data(NIR)
$ testing.plsNOCV <- plsr(y ~ X, 6, data =
2003 May 22
1
Possible R CMD check problem (PR#3070)
Using R 1.7.0 I get
* checking parcv-manual.tex ... ERROR
Could not create DVI version.
Although there is no apparent error. The dvi file exists.
Possibly there is some problem with my TeX setup, but the following
messages don't suggest that either.
Here's the full log, which does show some documentation issues:
sheep:~$R CMD check --library=.R/library/ src/parcv
* checking for working
2007 Sep 13
1
Collapsing data frame; aggregate() or better function?
Hello r-help,
I am trying to collapse or aggregate 'some' of a data frame. A very
simplified version of my data frame looks like:
> tester
trip set num sex lfs1 lfs2
1 313 15 5 M 2 3
2 313 15 3 F 1 2
3 313 17 1 M 0 1
4 313 17 2 F 1 1
5 313 17 1 U 1 0
And I want to omit sex from the picture and just get an addition of num,
2008 Apr 15
1
by inconsistently strips class - with fix
summary:
The function 'by' inconsistently strips class from the data to which
it is applied.
quick reason:
tapply strips class when simplify is set to TRUE (the default) due to
the class stripping behaviour of unlist.
quick answer:
This can be fixed by invoking tapply with simplify=FALSE, or changing
tapply to use do.call(c instead of unlist
executable example:
2005 Jul 04
1
A faster way to aggregate?
Dear List,
I have a logical data frame with NA's and a grouping factor, and I want to
calculate
the % TRUE per column and group. With an indexed database, result are mainly
limited by printout time, but my R-solution below let's me wait (there are
about 10* cases in the real
data set).
Any suggestions to speed this up? Yes, I could wait for the result in real
life, but just curious if I
2010 Jun 08
2
cross-validation
Hi
I want to do leave-one-out cross-validation for multinomial logistic regression in R. I did multinomial logistic reg. by package nnet in R. How I do validation? by which function?
response variable has 7 levels
please help me
Thanks alot
Azam
[[alternative HTML version deleted]]
2001 Jun 28
0
: k-fold cross validation for fda,mda etc
Hi all,
Has anyone tried to do k-fold cross validation for flexible discriminant
analysis ( mda library), for example, using crossval() in bootstrap?
The problem is that the function crossval() requires a separate matrix
for predictors and another for responses, whereas the function fda(),
using the formula argument only.
Is there another way of doing k-fold cross validation for functions
which
2013 Mar 02
2
caret pls model statistics
Greetings,
I have been exploring the use of the caret package to conduct some plsda
modeling. Previously, I have come across methods that result in a R2 and
Q2 for the model. Using the 'iris' data set, I wanted to see if I could
accomplish this with the caret package. I use the following code:
library(caret)
data(iris)
#needed to convert to numeric in order to do regression
#I
2011 Oct 16
2
How to plot CI's (llim ulim) on ecodist mgram
I would like to put confidence intervals on a mantel corellogram
they are already calculated in the pmgram object but I am unsure how I
get the x value in order to plot them?
package(ecodist)
X<-1:100
Y<-rnorm(1:100)
Z<-rnorm(1:100)
XY<-dist(data.frame(X,Y))
YX<-dist(data.frame(Y,X))
my.mgram<-mgram(XY,XZ)
plot(my.mgram)
print(my.mgram)
> print(my.mgram)
$mgram
2005 Feb 11
3
How to solve error : "cannot allocate vector of size 1208235 Kb"
Howdy R gurus !
I am newbie to R
I use R 2.0.1 in Windows XP. When I run R
I got the follwoing memory error.
My physical memory size is 3 Gb.
My R got the memory problem when it reached to
about 2 Gb.
Thanks in advance,
> library(spdep)
> sfr.lagsarlm <- lagsarlm(sfr.data$Bldgsqft ~ sfr.data$Ncounty + sfr.data$Nugb + sfr.data$Ngroup, data=sfr.data, listw=sfr.listw,
2005 Mar 02
1
AD group membership limits?
Hi,
I'm running Samba 3.0.11 on RedHat ES 3 kernel version 2.4.21-15.0.4.ELsmp
and have a quick question about AD group membership limits
Am I right in assuming that Samba is limited by the group membership
parameters (ie NGROUP = 32) imposed by the Linux kernel? Is there any
workaround in Samba for this?
At the moment if a user is a member of more then 32 domain groups they
cannot access
2011 Feb 22
1
Transfer function observed vs predicted values graph problem
Hi,
I am trying to make a palaeoenvironmental transfer function using the R
package rioja that predicts the water-table (measured as depth to the water
table) of an area given the testate amoebae that are found there. I've
carried out weighted averaging of the data and am trying to produce a graph
that shows the observed water-table versues the model's predicted values.
Following the
2011 Nov 07
0
Adding lines to scatterplot odd result when creating multiple plots
Dear R helpers
I'm attempting to create a matrix of scatterplots with X-Y mean lines and
regression lines added to each plot in the matrix. I have managed to create
the first plot I would like using scatterplot but have run into an odd
result when I use par() to set up the page to take multiple plot.
Specifically, the mean and regression lines appear to plot in the second
plot window, not
2010 May 20
1
computer out of memory when using sigpathway
Dear R users,
I am sorry to disturb you! But I really need your help for the usage of sigPathwy.
Actually, I want a sliding window analysis for possible chromosome expression pattern mining. My research microorganism is a plant pathogen, Gibberella zeae, and I first used SAS to divide locus number with 10, 20, 30, or 40 on the fungal chromosome according to their location. I really
1997 Aug 19
2
R-alpha: A few bugs in R-0.50-a3.
A few problems in R-0.50-a3 (which were also in R-0.49):
1)
y <- c(10,11,12,13,14,NA,NA)
n <- length(y)
missed <- (1:n)[is.na(y)]
notmissed <- (1:n)[!is.na(y)]
blocks <- cut(missed,breaks=c(0,notmissed,n+1))
a <- function(v) {
q <- range(v)
c(q[1]-1,q[2]+1)
}
brackets <- tapply(missed,blocks,a)
This codes gives the following in S:
> brackets
$"0+ thru 1":
2017 Aug 16
1
Bias-corrected percentile confidence intervals
Hi folks,
I'm trying to estimate bias-corrected percentile (BCP) confidence
intervals on a vector from a simple for loop used for resampling. I am
attempting to follow steps in Manly, B. 1998. Randomization, bootstrap
and monte carlo methods in biology. 2nd edition., p. 48. PDF of the
approach/steps should be available here:
https://wyocoopunit.box.com/s/9vm4vgmbx5h7um809bvg6u7wr392v6i9
If
2010 Mar 22
0
using lmer weights argument to represent heteroskedasticity
Hi-
I want to fit a model with crossed random effects and heteroskedastic
level-1 errors where inferences about fixed effects are of primary
interest. The dimension of the random effects is making the model
computationally prohibitive using lme() where I could model the
heteroskedasticity with the "weights" argument. I am aware that the weights
argument to lmer() cannot be used to