Displaying 2 results from an estimated 2 matches for "traintest1".
2008 Jun 25
1
LDA on pre-assigned training and testing data sets
...data set, and test it on another data set with the same variables. I found examples using crossvalidation, and using training and testing data sets set up with sample, but not when they are preassigned.
Here is what I tried
# FIRST SET UP A DATAFRAME WITH ALL THE DATA AND CREATE NEW VARIABLES
traintest1 <- arnaudnognod1[arnaudnognod1$DISC_USE1 == 1.01|arnaudnognod1$DISC_USE1 == 1.03|arnaudnognod1$DISC_USE1 == 1.04
|arnaudnognod1$DISC_USE1 == 1.02|arnaudnognod1$DISC_USE1 == 1.05|arnaudnognod1$DISC_USE1 == 1.06,]
traintest1$normal <- traintest1$DISC_USE1 == 1.01|traintest1$DISC_USE1 == 1.03|t...
2008 Jun 10
1
Question on lda and predict
...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 message:
<<<
Warning message:
'newdata' had 795 rows but variable(s) found have 796 rows
>>>
However, when I look at 'newdata' (i.e. traintest1) with dim, I find it has 796 rows:
<<<
> di...