[R] help with stepclass (klaR)

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Oct 4 12:58:51 CEST 2007


1. Stepwise selection might be inadequate for many problems.
2. You get a warning if an estimation step for one possible model does 
not work.
3. In your data, many variables do have variance 0 (identical values) 
within several classes. You might want to choose another kind of model, 
perhaps by dichotomizing at least some variables or so and applying a 
tree based method ...

Best wishes,
Uwe Ligges



Silvia Lomascolo wrote:
> I use Windows, R version 2.5.1
> 
> When I try to run stepclass (klaR) I get an error message/warning saying:
> 
> 1: error(s) in modeling/prediction step in: cv.rate(vars = c(model, tryvar),
> data = data, grouping = grouping,   ...
> 
> Actually, I look 16 warnings of this type.  Can anyone tell me what this
> means? 
> Also, it returns only 2 out of the 79 variables as important, however these
> variables don't make any biological sense... Might this be a problem of my
> coding?
> 
> Here's some code and sample matrix:
> 
>> library(klaR)
>> var <- read.table("C:\\Documents and Settings\\My
> Documents\\silvia\\data\\variables.txt", header=T) ## matrix of 79 variables
>> disp<- read.table("C:\\Documents and Settings\\My
> Documents\\silvia\\data\\disperser.txt", header=T) ## vector defining my
> groups
>> disp<- as.factor(disp$disperser)
>> data.step <- stepclass(var, disp, "lda", improvement = 0.05)
> 
> Sample matrix: 
> 
> var:
> P5.38	P6.45	P6.55	P6.63	P6.78	P6.87	P7.12	P7.42	P8.10	P8.88	P9.09	P9.30
> P9.49	P9.55
> 0.00	11.08	3.16	0.76	0.40	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.64	0.00
> 0.00	0.00	0.00	0.00	0.00	1.63	0.00	6.89	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	4.78	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	131.56	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	5.05	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	16.00	9.59
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.88	0.48	0.89	0.00	0.00	0.00	0.00	0.16	0.00	0.00	0.00	0.00	0.21	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.75	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	5.41	20.62	8.13	8.87	8.27	12.51	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	133.24	0.00	0.73	0.00	0.00	0.00	0.00	1.34	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	1.32
> 0.00	1.81	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 7.26	8.16	1.50	0.00	0.00	0.00	1.97	1.28	0.00	0.00	0.00	1.16	0.00	0.00
> 0.00	1.48	0.22	0.00	0.00	0.00	0.00	0.00	1.80	0.66	0.47	0.47	0.75	0.00
> 0.00	1.34	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	1.14	0.00
> 0.00	72.65	103.26	1.09	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.82	0.00	0.00	0.00	0.00	0.00	4.79	0.00	0.00	0.00	0.00	11.44	2.33	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	3.13	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.83	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	23.14	0.00	0.00	0.00	1.19	4.81	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	7.92	0.00	14.29	36.64	0.00	82.87	0.00	0.00	0.00	0.00	0.00	0.00
> 0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00	0.00
> 
> disp:
> disperser
> 1
> 1
> 1
> 1
> 1
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 2
> 3
> 3
> 4
> 4
> 4
> 4
> 4
> 4
> 4
> 4
> 4
> 4
> 
>



More information about the R-help mailing list