similar to: Getting the groupmean for each person

Displaying 20 results from an estimated 1400 matches similar to: "Getting the groupmean for each person"

2004 Feb 05
5
(Novice-) Problem with the plot-function
Hello, i have written this little function to draw different normal distributions: n.Plot <- function(x,my,sigma) { e <- exp(1) names(x) <- x f.x <- (1/(sigma*sqrt(2*pi)))*e^(-1*(((x-my)^2)/2*(sigma^2))) plot(f.x,type="l",xlim=c(-5,5)) return(f.x) } if i define x like this: x <- seq(-5,5,0.01) Now n.Plot(x,0,1) DOES draw the correct plot, but the x-axis is labeled
2009 Dec 08
1
Printing 'k' levels of factors 'n' times each, but 'n' is unequal for all levels ?
Dear List, I need to print out each of 'k' levels of a factor 'n' times each, where 'n' is the number of elements belonging to each factor. I know that this can normally be done using the gl() command, but in my case, each level 'k' has an unequal number of elements. Example with code is as below: vc<-read.table("P:\\Transit\\CORRECT
2004 May 15
1
Again some questions about multilevelanalysis
Dear list, I asked some questions about multilevelanalysis a couple of months ago. In the meantime I did some reading about the subject. Now I'd like to check, if I understood it all correctly. If you think my questions are not appropriate for this list, please tell me so and i will immediatly stop asking them. I have a dataset with one predicted variable (y), two explanatory variables
2004 Mar 21
1
Multilevel analysis with package lme
Dear list, i am a student of psychology and have to do a multilevelanalysis on some data. About that i have one general and one specific question. This is what i have copied from the help-file on lme: data(bdf) fm <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf, random = ~ IQ.ver.cen | schoolNR) summary(fm) after summary(fm) i get the following error:
2006 Sep 20
1
Pooled Covariance Matrix
I am in a discriminant analysis situation with a frame containing several variables and a grouping factor, if you like: set.seed(200906) exampledf <- as.data.frame(matrix(rnorm(50,5,2),nrow=10,ncol=5)) exampledf$Group <- factor(rep(c(1,2,3),c(3,3,4))) exampledf I'm sure there must be a simple way to get the within group pooled covariance matrix but I haven't found it yet. I
2004 Feb 12
2
calling R from a shell script and have it display graphics
Hello, I am running R under Linux/x11. I would like to call R from a shell script and have it display a series of graphics. The graphics should remain visible until the user clicks or presses a key. I first tried R BATCH, but it does not load the x11 module, making it impossible to open x11 or png devices. Then, I tried to call R with a 'here' script: R --vanilla --quiet --args
2007 Jun 19
2
Function -return value
Hi, I am trying to write a function with the following codes and I would like it to return the values for "alpha beta para parab " seperately. Then I would like to use this funstion for "variable" with factor "a" and "b". But the result turns out to be a matrix with element like "Numeric,2" ... I guess they are just the values for
2004 Feb 14
6
Beginner's question about t.test()
Dear All, I am doing some exercise in statistics textbook on comparison of two experimental means. Is it possible to use t.test() do t-test when I have only two means, sample size, two standard deviations ? (no raw data). Thanks. Pramote
2007 Jun 04
3
test for nested factors
Is there a conventional way to test for nested factors? I.e., if 'a' and 'b' are lists of same-length factors, does each level specified by 'a' correspond to exactly one level specified by 'b'? The function below seems to suffice, but I'd be happy to know of a more succinct solution, if it already exists. Thanks, Tim. --- "%nested.in%" <-
2003 Dec 09
2
PROC MIXED vs. lme()
I'm trying to learn how to do a repeated measures ANOVA in R using lme(). A data set that comes from the book Design and Analysis has the following structure: Measurements (DV) were taken on 8 subjects (SUB) with two experimental levels (GROUP) at four times (TRIAL). In SAS, I use the code: PROC MIXED DATA=[data set below]; CLASS sub group trial; MODEL dv = group trial group*trial;
2007 Jul 26
4
Finding matches in 2 files
I have 2 files containing data analysed by 2 different methods. I would like to find out which genes appear in both analyses. Can someone show me how to do this? _________________________________________________________________ [[trailing spam removed]] [[alternative HTML version deleted]]
2004 Apr 18
1
multistratum glm?
Hello, I routinely use aov and and the Error term to perform analyses of variance of experiments with 'within-subject' factors. I wonder whether a notion like 'multistratum models' exists for glm models when performing a logit analysis (without being 100% sure whether this would make sense). I have data of an experiment where the outcome is a categorical variable: 20
2007 Jun 28
4
compare 2 vectors
Dear all, I would like to take out the values from one vector that are equal to the values in another vector. Example: a <- c(1,2,3,4,5,6,7,8,9) b <- c(3,10,20,5,6) b_noRepeats = c(10,20) So I would like to have the vector b without the same values as vector a. Kind regards, João Fadista [[alternative HTML version deleted]]
2007 May 15
3
aov problem
I am using R to make two-way ANOVA on a number of variables using g <- aov(var ~ fact1*fact2) where var is a matrix containing the variables. However the outcome seem to be dependent on the order of fact1 and fact2 (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. Any ideas why this is? Thanks for any help Anders
2004 Jan 20
2
repeated measurements with R
Hello All, I have a more statistical question, and how this is implemented in R. The problem is the following: We have 2 different solutions (samples), which are filtered and then the concentration of the filtrate is measured. We want to evaluate how the filter proces and the concentration measurement influences the detection of the difference of the two solutions and which step has which
2004 May 10
7
strange behavior of names<-
Dear R-help, I've encounter what seems to me a strange problem with "names<-". Suppose I define the function: fun <- function(x, f) { m <- tapply(x, f, mean) ans <- x - m[match(f, unique(f))] names(ans) <- names(x) ans } which subtract out the means of `x' grouped by `f' (which is the same as, e.g., resid(lm(x~f)) if `f' is a factor).
2004 May 08
1
Surprise when indexing with a factor.
Hello, I had been thinking for years, without having ever checked (shame on me), that indexing a named vector by a factor 'f' produced the same results as indexing it by 'as.character(f)'. I was wrong, as the following example shows: (m <- c(a=1,b=2)) (f <- factor(c(1,2),labels=c('b','a'))) m[f] m[as.character(f)] m[as.numeric(f)] When the
2004 Mar 07
6
applying data generating function
Hello Coming from matlab background, I could use some help on this one. I need to generate a data set based on this equation X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a N(0,0,001) random variable I need say 100 values. How do I do this? Thanks
2003 Dec 08
1
aggregate and names of factors
Hello, I use the function 'aggregate' a lot. One small annoyance is that it is necessary to name the factors in the 'by' list to get the names in the resulting data.frame (else, they appear as Group.1, Group.2...etc). For example, I am forced to write: aggregate(y,list(f1=f1,f2=f2),mean) instead of aggregate(y,list(f1,f2),mean) (for two factors with short names, it is not such
2010 Sep 30
7
how to make list() return a list of *named* elements
If I combine elements into a list b <- c(22.4, 12.2, 10.9, 8.5, 9.2) my.c <- sample.int(round(2*mean(b)), 5) my.list <- list(b, my.c) the names of the elements seems to get lost in the process: > str(my.list) List of 2 $ : num [1:5] 22.4 12.2 10.9 8.5 9.2 $ : int [1:5] 11 8 6 9 20 If I explicitly name the elements at list-creation, I get what I want: my.list <- list(b=b,