Re: [R] generating symmetric matrices
hello try ?upper.tri # example p - 6 Rmat - diag(p) dat.cor - rnorm(p*(p-1)/2) Rmat[upper.tri(Rmat)]- dat.cor Rmat[lower.tri(Rmat)]- dat.cor Cleber Borges Greetings, I have a seemingly simple task which I have not been able to solve today. I want to construct a symmetric matrix of arbtriray size w/o using loops. The following I thought would do it: p - 6 Rmat - diag(p) dat.cor - rnorm(p*(p-1)/2) Rmat[outer(1:p, 1:p, )] - Rmat[outer(1:p, 1:p, )] - dat.cor However, the problem is that the matrix is filled by column and so the resulting matrix is not symmetric. I'd be grateful for any adive and/or solutions. Gregory ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] triangle contour plots
Hi, I used similar things to Chemical Mixture Modelling. ( Scheffe model) I make the function below. Cleber + trimage - function(f){ x = y = seq( 1, 0, l=181 ) t1 = length(x) im = aux = numeric(0) for( i in seq( 1, t1, by = 2 ) ){ #idx = seq( t1**2, i*t1, by = -t1 ) - ((t1 - i):0) idx = seq( i*t1, t1**2, by = t1 ) - (i-1) im = c(im, aux, idx, aux ) aux = c(aux, NA) } z = outer(X=x, Y=y, FUN=f) return( matrix(z[im],nr=t1) ) } # # Example: f = function(x1,x2){ x3 = 1 - x1 - x2 z = x1 + 0*x2 -x3 + 4*x1*x2 + 27*x1*x2*x3 return( z ) } z = trimage( f ) par( xaxt='n', yaxt='n', bty='n', pty='s') image( z, col=rainbow(256) ) contour( z, add=T ) Robin Hankin wrote: Suppose I have three numbers p1, p2, p3 with 0 = p1,p2,p3 = 1 and p1+p2+p3=1, and a function f=f(p1,p2,p3) = f(p1,p2,1-p1-p2). How to draw a contour plot of f() on the p1+p2+p3=1 plane, that is, an equilateral triangle? Functions triplot(), triangle.plot(), and ternaryplot() give only scatterplots, AFAICS ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] R^2 from lme function
Hello allR How to access R^2 from lme object? or how to calculate it? ( one detail: my model do not have a intercept ) thanks in advanced Cleber ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] R^2 from lme function
Hi Martin, many thanks for your tip! but,{ :-( } what it 'full MLE' ? how to calculate? it is a saturated model??? and it is valid for 'no-intercept model? Many thanks again... Cleber Hi Cleber, I have been using this function I wrote for lmer output. It should be easy to convert to lme. As with everything, buyer beware. Note that it requires (full) maximum likelihood estimates. Rsq - function(reml.mod) { ## Based on ## N. J. D. Nagelkerke. A note on a general definition ## of the coefficient of determination. Biometrika, 78:691–692, 1991. ml.mod - update(reml.mod, method=ML) l.B - logLik(ml.mod) l.0 - logLik( lm([EMAIL PROTECTED] ~ 1) ) Rsq - 1 - exp( - ( 2/length([EMAIL PROTECTED]) ) * (l.B - l.0) ) Rsq[1] } Hank Hello allR How to access R^2 from lme object? or how to calculate it? ( one detail: my model do not have a intercept ) thanks in advanced Cleber ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] about contrasts
Hi all R-users Please, I would like to learn about 'contrasts'. I do not know much about importance and several types (of contrasts) over regression and data analysis. I would like references for my study! Thanks in advanced... klebyn ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] data in serial port... how to read
Hello all Is there a package for reading data in serial port (COM1 in windows) ? Is there a simple way for make this? thanks for any tips! Cleber Borges ___ Experimente já e veja as novidades. __ 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 and provide commented, minimal, self-contained, reproducible code.