Displaying 20 results from an estimated 10000 matches similar to: "help with predict.lda"
2010 Apr 26
3
R.GBM package
HI, Dear Greg,
I AM A NEW to GBM package. Can boosting decision tree be implemented in
'gbm' package? Or 'gbm' can only be used for regression?
IF can, DO I need to combine the rpart and gbm command?
Thanks so much!
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
2010 May 26
1
how to Store loop output from a function
HI, Dear R community,
I am writing the following function to create one data set(*tree.pred*) and
one vector(*valid.out*) from loops. Later, I want to use the data set from
this loop to plot curves. I have tried return, list, but I can not use the
*tree.pred* data and *valid.out* vector.
auc.tree<- function(msplit,mbucket) {
* tree.pred<-data.frame()
2012 Jan 17
1
Error predict with lda and cross validation
Hi, I use the lda function from the MASS package to classify some
samples according to some chemical properties. If I run lda without
cross validation all is ok but, if I run lda with cross validation,
the R consol say:
resLDA <- ldaRedOx <- lda(Activity ~ TRedOx[,1:6], CV=TRUE,
data=dfDataRedOx, subset=train)
predLDA <- predict(resLDA, newdata=dfDataRedOx[-train,])$class
>
2010 Sep 07
1
change the for loops with lapply
cv.fold<-function(i, size=3, rang=0.3){
cat('Fold ', i, '\n')
out.fold.c <-((i-1)*c.each.part +1):(i*c.each.part)
out.fold.n <-((i-1)*n.each.part +1):(i*n.each.part)
train.cv <- n.cc[-out.fold.c, c(2:2401, 2417)]
train.nv <- n.nn[-out.fold.n, c(2:2401, 2417)]
train.v<-rbind(train.cv, train.nv) #training data for feature
2010 Apr 29
2
can not print probabilities in svm of e1071
> x <- train[,c( 2:18, 20:21, 24, 27:31)]
> y <- train$out
>
> svm.pr <- svm(x, y, probability = TRUE, method="C-classification",
kernel="radial", cost=bestc, gamma=bestg, cross=10)
>
> pred <- predict(svm.pr, valid[,c( 2:18, 20:21, 24, 27:31)],
decision.values = TRUE, probability = TRUE)
> attr(pred, "decision.values")[1:4,]
2005 May 14
1
lda
Dear R-helpers,
if I am right a discriminant analysis can be done with "lda".
My questions are:
1. What method to discriminate the groups is used by "lda" (Fisher's linar
discriminant function, diagonal linear discriminant analysis, likelihood ratio
discriminant rule, ...)?
2. How can I see, which method is used? (Typing just lda does not give me any
code).
Thank you in
2010 Apr 06
2
help output figures in R
somfunc<- function (file) {
aa_som<-scale(file)
final.som<-som(data=aa_som, rlen=10000, grid=somgrid(5,4, "hexagonal"))
pdf(file="/home/cdu/changbin/file.pdf") #output graphic file.
plot(final.som, main="Unsupervised SOM")
dev.off()
}
I have many different files, if I want output pdf file with the same name
as for each dataset I feed to the function
2012 Aug 01
1
Different results between lda(mass) and spss discriminant analysis
Hi all,
I obtained a strage result with LDA (MASS) function in R with NIR data.
I tried both CV (leave one out cross validation) and splitting my data in
odd (training) and even (prediction) sets.
In all the cases the minimum error was near to 0.
Due to the strange result, I tried with SPSS IBM software and it give me
around 11% of minimum error with and without leave one out cross validation.
2008 Jun 10
1
Question on lda and predict
Hello
Using R 2.7.0 on Windows.
I am running a linear discriminant analysis as follows
<<<<
discrim1 <- lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+
cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train)
prediction <- predict(discrim1, traintest1[-train,])$class
>>>
When I do this, I get a warning
2010 May 18
2
get the row sums
> head(en.id.pr)
valid.gene_id b.pred rf.pred svm.pred
1521 2500151211 0 0 0
366 639679745 0 0 0
1965 2502081603 1 1 1
1420 644148030 1 1 1
1565 2500626489 1 1 1
1816 2501711016 1 1 1
> p.pred <- data.frame(en.id.pr, sum=apply(en.id.pr[,2:4], 1, sum)) #
2010 Jun 02
1
how to label the som notes by the majority vote
HI, Dear R community,
I am using the following codes to do the som. I tried to label the notes by
the majority vote. either through mapping or prediction.
I attached my output, the left one dont have any labels in the note, the
right one has more than one label in each note. I need to have only one
label for each note either by majority vote or prediction.
Can anyone give some suggestions or
2010 May 05
2
probabilities in svm output in e1071 package
svm.fit<-svm(as.factor(out) ~ ., data=all_h, method="C-classification",
kernel="radial", cost=bestc, gamma=bestg, cross=10) # model fitting
svm.pred<-predict(svm.fit, hh, decision.values = TRUE, probability = TRUE) #
find the probability, but can not find.
attr(svm.pred, "probabilities")
> attr(svm.pred, "probabilities")
1 0
1 0 0
2 0
2010 Oct 25
1
help with adding lines to current plot
HI, Dear R community,
I am using the following codes to plot, however, the lines code works. But
the line was not drawn on the previous plot and did not shown up.
How comes?
# specify the data for missense simulation
x <- seq(0,10, by=1)
y <- c(0.952, 0.947, 0.943, 0.941, 0.933, 0.932, 0.939, 0.932, 0.924, 0.918,
0.920) # missense
z <- c(0.068, 0.082, 0.080, 0.099, 0.108, 0.107,
2010 May 25
4
R eat my data
HI, Dear R community,
My original file has 1932 lines, but when I read into R, it changed to 1068
lines, how comes?
cdu@nuuk:~/operon$ wc -l id_name_gh5.txt
1932 id_name_gh5.txt
> gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t",
skip=0, header=F, fill=T)
> dim(gene_name)
[1] 1068 3
--
Sincerely,
Changbin
--
Changbin Du
DOE Joint Genome
2010 Jun 15
1
output from the gbm package
HI, Dear Greg and R community,
I have one question about the output of gbm package. the output of Boosting
should be f(x), from it , how to calculate the probability for each
observations in data set?
SInce it is stochastic, how can guarantee that each observation in training
data are selected at least once? IF SOME obs are not selected, how to
calculate the training error?
Thanks?
--
2010 Dec 16
1
my function does not work for large data set
Dear R community,
I have one function, it works for small data set, but does not work on large
data set, can anyone help me with this?
> #creat new variable by dividing each aa dimer by total_length.
> imper<-function(x, file) {
+ round(x/file$length, 5)
+ }
> dim(test)
[1] 999 2402
> test[varname[2:2401]]<-
2010 Apr 23
1
help in conditional histogram
Dear Dr. Sarkar,
When I try to run the codes, I found the following problem:
> h<- sample(1:14, 319, rep=T)
> c<- sample(1:14, 608, rep=T)
> n<- sample(1:14, 1140, rep=T)
> vt<-c(h, c, n)
> ta<-rep(c("h", "c", "n"), c(319, 608, 1140))
>
> to<-data.frame(vt,ta)
> library(lattice)
Attaching package: 'lattice'
2006 Nov 11
1
predict.lda is missing ?
I'm trying to classify some observations using lda and I'm getting a
strange error. I loaded the MASS package and created a model like so:
>train <- mod1[mod1$rand < 1.7,]
>classify <- mod1[mod1$rand >= 1.7,]
>lda_res <- lda(over_win ~ t1_scrd_a + t1_alwd_a, data=train, CV=TRUE)
That works, and all is well until I try to do a prediction for the holdouts:
2010 Apr 21
2
?rpart
HI, Dear R community,
Last friday, I used the codes, it works, but today, it does not run?
> fit.dimer <- rpart(outcome ~., method="class", data=p.df)
Error in `[.data.frame`(frame, predictors) : undefined columns selected
DOEs anyone have comments or suggestions? Thanks in advance!
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
2011 Sep 01
3
how to split a data frame by two variables
HI, Dear R community,
I want to split a data frame by using two variables: let and g
> x = data.frame(num =
c(10,11,12,43,23,14,52,52,12,23,21,23,32,31,24,45,56,56,76,45), let =
letters[1:5], g = 1:2)
> x
num let g
1 10 a 1
2 11 b 2
3 12 c 1
4 43 d 2
5 23 e 1
6 14 a 2
7 52 b 1
8 52 c 2
9 12 d 1
10 23 e 2
11 21 a 1
12 23 b 2
13 32 c 1
14