[R] mean from list
hi all, I have a simple problem that i am not able to solve. I've a list called datalist with the following structure: [...] [[10]] [[10]]$a -1 0 1 -1 31 5 2 0 6 7 5 1 1 7 36 [[10]]$b -1 0 1 -1 31 5 2 0 6 7 5 1 1 7 36 [[10]]$c [1] 0.855 [[10]]$d [1] 0.855 [...] with [[1]] ... [[100]]. How can i get the mean value of datalist[[x]]$d, where x represents all elements from 1 to 1000 ? thanks in advance Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo è protetta da SPAMfighter 205 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: mean from list
great!! thanks very much, mean(unlist(lapply(listdata, function(z) z$c))) works well. and what about getting the average table $a (displaying the average elements across all 1000 matrix)? could you please help me? I am struggling with this... thanks in advance Roberto mean(unlist(lapply(x, function(z) z$d))) should do the trick On Sun, 12 Feb 2006 20:06:12 +, [EMAIL PROTECTED] wrote: hi all, I have a simple problem that i am not able to solve. I've a list called datalist with the following structure: [...] [[10]] [[10]]$a -1 0 1 -1 31 5 2 0 6 7 5 1 1 7 36 [[10]]$b -1 0 1 -1 31 5 2 0 6 7 5 1 1 7 36 [[10]]$c [1] 0.855 [[10]]$d [1] 0.855 [...] with [[1]] ... [[100]]. How can i get the mean value of datalist[[x]]$d, where x represents all elements from 1 to 1000 ? thanks in advance Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo è protetta da SPAMfighter 205 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net La mia Cartella di Posta in Arrivo è protetta da SPAMfighter 205 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plots
Hi all, I have a basic question. how can i visualize two or more density curves on the same plot? ex: x1-runif(100,10,80) x2-runif(100,1,100) kernelgraf-density(x1,kernel = gaussian, width= 20) plot(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1), col=rgb(0,1,0), main=) kernelgraf-density(x2,kernel = gaussian, width= 20) points(kernelgraf, xlab=Probability, xlim=c(0,100), ylim=c(0,.1), col=rgb(0,0,1), main=) here i am using plot + points, but i do not like the graphical output for points. can anybody help me? thanks in advance Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo e protetta da SPAMfighter 204 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Shapley Values
Hi, I am trying to compute the Shapley Values between a set of p independent variables (x1, ..., xp) and the dependent variable y to study the relationships. I believe that the package kappalab could be an appropriate choice. Is anybody able to give me some hints about the code I should write? Any better package? thanks in advance! Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo è protetta da SPAMfighter 202 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Shapley Values
Hi, I am trying to compute the Shapley Values between a set of p independent variables (x1, ..., xp) and the dependent variable y to study the relationships. I believe that the package kappalab could be an appropriate choice. Is anybody able to give me some hints about the code I should write? Any better package? thanks in advance! Roberto Furlan University of Turin La mia Cartella di Posta in Arrivo e protetta da SPAMfighter 201 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] homogeneity index
Hi, i would like to have an homogeneity index to compare the homogeneity of matrices like: 1 2 3 4 5 6 7 8 9 10 11 12 1 5 11 12 6 21 14 13 8 15 12 12 2 12 12 9 8 11 14 15 12 17 18 3 10 13 18 14 16 9 14 8 12 4 12 14 11 7 17 12 14 9 511 12 12 9 19 15 13 69 8 13 12 13 6 7 11 15 9 11 16 8 15 10 14 14 915 9 14 10 3 12 11 13 12 These are treatments in a factorial design. My aim is to get a summary index for the balance property and to compare this score across different matrices. I would like to have a pure number in order to get a score non affected by the number of elements in the matrix and their magnitude. I would like an index ranging between 0 and 1. What would you suggest? any index already written in R? thanks in advance Roberto Furlan University of Torino La mia Cartella di Posta in Arrivo e protetta con SPAMfighter 192 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: fractional factorial design in R
If an orthogonal main effect plan exists for the number of trials you specify, optFederov() in AlgDesign will more than likely find it for you, since such a design should be an optimal design. thanks very much to you and the others!! I have written a little function, and now the syntax to obtain an orthogonal design such as 2x4x3x2 is: design.test - gen.orthogonal.design(c(2,4,3,2)) gen.orthogonal.design - function(listFactors){ library(AlgDesign) FactorsNames-c(A,B,C,D,E,F,G,H,J,K,L) numFactors-length(listFactors) dat-gen.factorial(listFactors,center=FALSE,varNames=FactorsNames[1:numFacto rs]) desPB-optFederov(~.,dat,nRepeats=20,approximate=TRUE) design-desPB$design[,2:numFactors] cat(Minimum number of trials: , fill=T, length(design[,1]), append=T) #cor(design) return(design) } Roberto Furlan University of Turin, Italy La mia Cartella di Posta in Arrivo è protetta con SPAMfighter 188 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: fractional factorial design in R
sorry, some small mistakes in the previuos syntax. This works! design.test - gen.orthogonal.design(c(2,4,3),numCards=16) design.test gen.orthogonal.design - function(listFactors,numCards){ library(AlgDesign) FactorsNames-c(A,B,C,D,E,F,G,H,J,K,L) numFactors-length(listFactors) dat-gen.factorial(listFactors,center=FALSE,varNames=FactorsNames[1:numFacto rs]) desPB-optFederov(~.,dat,nRepeats=20,approximate=FALSE,nTrials=numCards) design-desPB$design#[,2:(numFactors+1)] cat(Number of trials: , fill=T, length(design[,1]), append=T) print(cor(design)) return(design) } However, it is necessary to run the function and guess numCards until the correlation matrix is diagonal and all levels are selected for the final design. Any idea how to solve this problem without an iterative function? Roberto Furlan University of Turin, Italy La mia Cartella di Posta in Arrivo è protetta con SPAMfighter 188 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: fractional factorial design in R
Hi! thanks for your response! unfortunately, fractional factorial designs typically require all factors to have the same number of levels. Hence, your 2x3x3x5x2 example is not a simple special case of a fractional factorial design. There are some special plans for mixed level designs, but the conf.design function requires all factors to have the same number of levels, as you can also find in its help: p: The common number of levels for each factor. Must be a prime number. ffDesMatrix from package BHH2 is even worse, since it requires all factors to have 2 levels: k: numeric. The number of 2-levels design factors in the designs. I've tried both ffDesMatrix and conf.design and i realized that they cannot help me for the problem above. At the moment, I am using an SPSS function (orthoplan) for my needs. It provides factorial design with only main effects (small orthogonal designs). Since SPSS is very expensive (in particular with this add-on), I would like to use R as for all my other projects and research activity. Do you know any other way to produce these designs in R? Thanks in advance, Roberto Furlan University of Turin, Italy La mia Cartella di Posta in Arrivo è protetta con SPAMfighter 188 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: fractional factorial design in R
Yes, you're right. For, say, a 3 x 5 design, one can do this in as few as 7 runs -- but only in general by some version of one-factor-at-a-time (OFAT) designs, which are inefficient. It is easy, via, say model.matrix() to write a general function to produce these. But I think it's a bad idea; more efiicient algorithmic designs are better, IMO, which is why I suggested AlgDesign. You and others are free to disagree, of course. Hi Bert, thanks for your suggestion. However, let us say that i need a 2x2x2x3x3x3 design, which should not be too hard. I've loaded AlgDesign, and i am aware now that gen.factorial allows me to create a full desing. But how to create a main-effects-only factorial design (orthogonal)? I am still not able to produce what i need. The function model.matrix.formula is not very clear... :( Could you please indicate which syntax should i use? I'd really appreciate your help. Thanks in advance, Roberto Furlan University of Turin, Italy La mia Cartella di Posta in Arrivo è protetta con SPAMfighter 188 messaggi contenenti spam sono stati bloccati con successo. Scarica gratuitamente SPAMfighter! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html