[R] Error when using s.multinom() of the ade4 package - %PCA and MCOA

Fridolin smells_like_rock at gmx.net
Fri Sep 7 16:49:06 CEST 2012


Hello,

I am working with s.multinom() from the ade4package. I tried to plot the
results of my %PCA (via the function dudi.pca()) followed by a MCOA
(mcoa()). But when I give my variables to s.multinom() I get the following
Error message: 
Error in FUN(1:14[[1L]], ...) : number 1 profile without data
I know that it has to do with one (or two?) of the first arguments
(kpca,sglmarkerfrq) but I just don't get what this error means nor what I
can do to fix it. I have successfully done all the same procedure with a set
of raw data already, only difference of the data now is that I don't use the
raw allelic frequencies as input for the %PCA but instead their natural
logarithm. When I compare the values and the structures of the variables
kpca, sglmarkerfrq and round between the raw data and the ln(data), I see no
obvious difference: same number of columns and colnames, same number of rows
and rownames, similar values which can be in both cases positive and
negative numerics. Only difference is that the raw data-sglmarkerfrq is
always between 0 and 1, while ln-sglmarkerfrq is because of the
ln-transformation also beyond these borders. The helppage of s.multinom()
says for the required format of sglmarkerfrq that its rows are "profiles or
frequency distributions" - as they are beyond the zero-to-one-broders they
are no frequencies, but what is a profile?? Is that causing the error? If
so, obviously it's not possible to do a transformation of the data before
doing the %PCA-MCOA-procedure.

My simplified script looks like this:

#input for plot:
CS1<-c("0.03284677","-0.05042881","-0.27243890","-0.66421741","-0.18941098","-0.66715350")
CS2<-c("-0.01775171","0.41238847","-0.11064511","0.64280144","0.02907561","-0.63508992")
rownames=c("scm266.305","scm266.308","scm266.311","scm266.314","scm266.353","scm266.999")
kpca<-data.frame(CS1,CS2,row.names=rownames)
kpca

s305<-as.numeric(c("-4.168989e-01","-6.931516e-01","-6.706789e-01","-3.646494e-01","-1.078945e-01","-5.555534e-06","-3.272183e-01","-2.799655e-01","-6.899835e-02","-1.034077e+00","-5.716390e-02","-4.924813e-01","-1.206335e-01","-3.390707e-02"))
s308<-as.numeric(c("-1.838279","-1.504079","-1.181503","-1.504079","-2.685567","-13.710157","-1.621135","-1.409827","-13.710157","-3.806619","-2.890358","-1.003306","-2.174749","-4.499716"))
s311<-as.numeric(c("-13.687684","-13.710157","-13.687684","-13.487015","-13.687684","-13.710157","-13.664695","-13.664695","-13.710157","-1.504079","-13.710157","-13.710157","-13.687684","-13.710157"))
s314<-as.numeric(c("-1.704749","-1.280937","-2.867886","-13.487015","-3.378698","-13.710157","-2.844896","-13.664695","-3.806619","-2.708040","-13.710157","-3.806619","-13.687684","-13.710157"))
s353<-as.numeric(c("-13.687684","-13.710157","-13.710157","-2.280108","-13.687684","-13.710157","-13.664695","-13.664695","-13.710157","-13.710157","-13.710157","-13.710157","-13.687684","-13.710157"))
s999<-as.numeric(c("-13.687684","-13.687684","-3.784146","-2.484898","-13.687684","-13.710157","-3.761157","-13.664695","-3.113497","-1.098616","-13.710157","-13.710157","-13.687684","-3.806619"))
popnames<-c("Altevogt 14160","IRAN GP. IX","Türkischer
Unkrautroggen","R778","R1008","Pico Gentario","Centeio
Branco","Belorusskaja","Carokurz","Florida Black","Halo","Karel.
Landsorte","Leningrader Landsorte","Dankowskie Selekcyjne")
sglmarkerfrq<-data.frame(s305,s308,s311,s314,s353,s999,row.names=popnames)
names(sglmarkerfrq)<-c("scm266.305","scm266.308","scm266.311","scm266.314","scm266.353","scm266.999")
sglmarkerfrq

nobs<-c(88.0006,90.0004,88.0006,72.0002,88.0006,90.0004,86.0008,86.0008,90.0004,90.0004,90.0004,90.0004,88.0006,90.0004)
round<-round(nobs) #is rounding necessary?

col<-c("darkgreen","springgreen4","limegreen","lavender","aquamarine","darkorchid3","orange","cornflowerblue","darkorchid4","gold","royalblue3","firebrick3","firebrick4","darkblue")

#load package:
library(adegenet)

#plot:
png(file="ln_PCA.png",width=1000)
par(mfrow=c(1,2))
s.multinom(kpca,sglmarkerfrq,n.sample=round,xlim=c(-1,1),ylim=c(-1,1),coulrow=col,sub="uncoordinated
%PCA (ln)")
dev.off()


Any help would be highly appreciated!

Thx, Frido



--
View this message in context: http://r.789695.n4.nabble.com/Error-when-using-s-multinom-of-the-ade4-package-PCA-and-MCOA-tp4642503.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list