Christoph Lehmann
2003-Jun-01 07:24 UTC
[R] compositional data: percent values sum up to 1
again, under another subject: sorry, maybe an all too trivial question. But we have power data from J frequency spectra and to have the same range for the data of all our subjects, we just transformed them into % values, pseudo-code: power[i,j]=power[i,j]/sum(power[i,1:J]) of course, now we have a perfect linear relationship in our x design-matrix, since all power-values for each subject sum up to 1. How shall we solve this problem: just eliminate one column of x, or introduce a restriction which says exactly that our power data sum up to 1 for each subject? Thanks a lot Christoph -- Christoph Lehmann <lehmann at puk.unibe.ch> University Hospital of Clinical Psychiatry -- Christoph Lehmann <christoph.lehmann at gmx.ch>
Good afternoon R-masters, I am with some doubts in the R, see the script below: m<-c(69.6,67.3,75.6,74.3,64.7,60,65.7,62.5,66.5) d<-c(11.6,15,17.8,18.3,11.2,11,4.6,5.8,7) year<-c(1994,1995,1996,1997,1998,1999,2000,2001,2002) male<-ts(m,start=c(1994)) death<-ts(d,start=c(1994)) data<-data.frame(year,death,male) require(ts) d100<-HoltWinters(data$death,gamma=0) m100<-HoltWinters(data$male,gamma=0) par(mfrow=c(3,1)) plot(d100,main="Death") plot(m100,main="Male") ccf(male,death) I have 2 doubts: 1 - How to I should interpret the third graph? 2 - Has a hypothesis test to evaluate the cross-correlation it is significant in R? Thanks in advance Bernardo Rangel Tura, MD, MSc National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil
What are you trying to do? What I would do with this depends on many factors. spencer graves Christoph Lehmann wrote:> again, under another subject: > sorry, maybe an all too trivial question. But we have power data from J > frequency spectra and to have the same range for the data of all our > subjects, we just transformed them into % values, pseudo-code: > > power[i,j]=power[i,j]/sum(power[i,1:J]) > > of course, now we have a perfect linear relationship in our x design-matrix, > since all power-values for each subject sum up to 1. > > How shall we solve this problem: just eliminate one column of x, or > introduce a restriction which says exactly that our power data sum up to > 1 for each subject? > > Thanks a lot > > Christoph
Christoph Lehmann
2003-Jun-02 07:23 UTC
[R] compositional data: percent values sum up to 1
I want to do a logistic regression analysis, and to compare with, a discriminant analysis. The mentioned power maps are my exogenous data, the dependent variable (not mentioned so far) is a diagnosis (ill/healthy) thanks for the interest and the help Christoph On Sun, 2003-06-01 at 21:01, Spencer Graves wrote:> What are you trying to do? What I would do with this depends on many > factors. > > spencer graves > > Christoph Lehmann wrote: > > again, under another subject: > > sorry, maybe an all too trivial question. But we have power data from J > > frequency spectra and to have the same range for the data of all our > > subjects, we just transformed them into % values, pseudo-code: > > > > power[i,j]=power[i,j]/sum(power[i,1:J]) > > > > of course, now we have a perfect linear relationship in our x design-matrix, > > since all power-values for each subject sum up to 1. > > > > How shall we solve this problem: just eliminate one column of x, or > > introduce a restriction which says exactly that our power data sum up to > > 1 for each subject? > > > > Thanks a lot > > > > Christoph > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help-- Christoph Lehmann <christoph.lehmann at gmx.ch>
"glm" will do multinomial logistic regression. However, if J is large, I doubt if that will do what you want. If it were my problem, I might feel a need to read the code for "glm" and modify it to do what I want. Perhaps someone else can suggest something better. hth. spencer graves Christoph Lehmann wrote:> I want to do a logistic regression analysis, and to compare with, a > discriminant analysis. The mentioned power maps are my exogenous data, > the dependent variable (not mentioned so far) is a diagnosis > (ill/healthy) > > thanks for the interest and the help > > Christoph > > On Sun, 2003-06-01 at 21:01, Spencer Graves wrote: > >>What are you trying to do? What I would do with this depends on many >>factors. >> >>spencer graves >> >>Christoph Lehmann wrote: >> >>>again, under another subject: >>>sorry, maybe an all too trivial question. But we have power data from J >>>frequency spectra and to have the same range for the data of all our >>>subjects, we just transformed them into % values, pseudo-code: >>> >>>power[i,j]=power[i,j]/sum(power[i,1:J]) >>> >>>of course, now we have a perfect linear relationship in our x design-matrix, >>>since all power-values for each subject sum up to 1. >>> >>>How shall we solve this problem: just eliminate one column of x, or >>>introduce a restriction which says exactly that our power data sum up to >>>1 for each subject? >>> >>>Thanks a lot >>> >>>Christoph >> >>______________________________________________ >>R-help at stat.math.ethz.ch mailing list >>https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
Prof Brian Ripley
2003-Jun-02 15:56 UTC
[R] compositional data: percent values sum up to 1
On Mon, 2 Jun 2003, Spencer Graves wrote:> "glm" will do multinomial logistic regression. However, if J is large,Strictly, no, it will not as that is not a GLM. glm() can only do it via surrogate Poisson models. multinom in nnet(VR) will do multinomial logistic regression.> I doubt if that will do what you want. If it were my problem, I might > feel a need to read the code for "glm" and modify it to do what I want. > Perhaps someone else can suggest something better. > > hth. spencer graves > > Christoph Lehmann wrote: > > I want to do a logistic regression analysis, and to compare with, a > > discriminant analysis. The mentioned power maps are my exogenous data, > > the dependent variable (not mentioned so far) is a diagnosis > > (ill/healthy) > > > > thanks for the interest and the help > > > > Christoph > > > > On Sun, 2003-06-01 at 21:01, Spencer Graves wrote: > > > >>What are you trying to do? What I would do with this depends on many > >>factors. > >> > >>spencer graves > >> > >>Christoph Lehmann wrote: > >> > >>>again, under another subject: > >>>sorry, maybe an all too trivial question. But we have power data from J > >>>frequency spectra and to have the same range for the data of all our > >>>subjects, we just transformed them into % values, pseudo-code: > >>> > >>>power[i,j]=power[i,j]/sum(power[i,1:J]) > >>> > >>>of course, now we have a perfect linear relationship in our x design-matrix, > >>>since all power-values for each subject sum up to 1. > >>> > >>>How shall we solve this problem: just eliminate one column of x, or > >>>introduce a restriction which says exactly that our power data sum up to > >>>1 for each subject? > >>> > >>>Thanks a lot > >>> > >>>Christoph > >> > >>______________________________________________ > >>R-help at stat.math.ethz.ch mailing list > >>https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Eh? The original message says it's the design matrix that is perfectly collinear after the transformation, not the response. I don't know much about this type of data, but seems like you could just fit the model w/o intercept to eliminate the collinearity, no? It's the interpretation of the result that may be tricky, I think. Andy> -----Original Message----- > From: Spencer Graves [mailto:spencer.graves at pdf.com] > Sent: Monday, June 02, 2003 9:33 AM > To: Christoph Lehmann > Cc: Spencer Graves; r-help at stat.math.ethz.ch > Subject: Re: [R] compositional data: percent values sum up to 1 > > > "glm" will do multinomial logistic regression. However, if J > is large, > I doubt if that will do what you want. If it were my > problem, I might > feel a need to read the code for "glm" and modify it to do > what I want. > Perhaps someone else can suggest something better. > > hth. spencer graves > > Christoph Lehmann wrote: > > I want to do a logistic regression analysis, and to compare with, a > > discriminant analysis. The mentioned power maps are my > exogenous data, > > the dependent variable (not mentioned so far) is a diagnosis > > (ill/healthy) > > > > thanks for the interest and the help > > > > Christoph > > > > On Sun, 2003-06-01 at 21:01, Spencer Graves wrote: > > > >>What are you trying to do? What I would do with this > depends on many > >>factors. > >> > >>spencer graves > >> > >>Christoph Lehmann wrote: > >> > >>>again, under another subject: > >>>sorry, maybe an all too trivial question. But we have > power data from J > >>>frequency spectra and to have the same range for the data > of all our > >>>subjects, we just transformed them into % values, pseudo-code: > >>> > >>>power[i,j]=power[i,j]/sum(power[i,1:J]) > >>> > >>>of course, now we have a perfect linear relationship in > our x design-matrix, > >>>since all power-values for each subject sum up to 1. > >>> > >>>How shall we solve this problem: just eliminate one column of x, or > >>>introduce a restriction which says exactly that our power > data sum up to > >>>1 for each subject? > >>> > >>>Thanks a lot > >>> > >>>Christoph > >> > >>______________________________________________ > >>R-help at stat.math.ethz.ch mailing list > >>https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >