search for: factor1

Displaying 20 results from an estimated 101 matches for "factor1".

Did you mean: factor
2013 Mar 06
6
Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?
...="white", lty = 1:2, cex=1, bty="n") # This did not work in ggplot2. What are my alternatives. I have extensively searched the internet and have I missed something obvious, it was due to # tiredness and not to lazyness. # Some dummy data: mydata<- data.frame(factor1 = factor(rep(LETTERS[1:6], each = 80)), factor2 = factor(rep(c(1:5), each = 16)), factor3 = factor(rep(c(1:4), each = 4)), var1 = rnorm(120, mean = rep(c(0, 3, 5), each = 40), sd = rep(c(1, 2, 3), each = 20)),...
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
...it. Here is my code and comments: I want to have my factor 1 in the order: "F", "E", "C", "D", "A", "B" instead of alphabetical. My normal methods do not work. with kind regards Anna Zakrisson # Some dummy data: mydata<- data.frame(factor1 = factor(rep(LETTERS[1:6], each = 80)), factor2 = factor(rep(c(1:5), each = 16)), factor3 = factor(rep(c(1:4), each = 4)), var1 = rnorm(120, mean = rep(c(0, 3, 5), each = 40), sd = rep(c(1, 2, 3), each = 20...
2009 Dec 11
3
Correcting for missing data combinations
I can think of many brute-force ways to do this outside of R, but was wondering if there was a simple/elegant solution within R instead. I have a table that looks something like the following: Factor1 Factor2 Value A 11/11/2009 5 A 11/12/2009 4 B 11/11/2009 7 B 11/13/2009 8 >From that I need to generate all permutations of Factor1 and Factor2 and force a 0 for any combination that doesn?t exist in the actual data table. By way of example, I?d like the output for above to end up as: Facto...
2005 Oct 13
1
Problem whit a piece of program
Hi friends, I'm beginning in R and I have simple question. I have this piece of my program and how you see, that's ok (whit > num<- 0.002) num<-0.002 # ok, but not when I change whit num<-0... ? factor1<-1; while(1) { if (num*factor1<1) factor1<-factor1*10 else { print("out ok!!"); break; } } [1] "out ok!!" but when I change (whit > num<-0) R show this: Error in if (num * factor1 < 1) factor1 <- factor1 * 10 else { : missing value where TRUE/FALSE neede...
2002 Nov 29
2
Obtaining the variable names of a glm object
...;re looking for? -----Original Message----- From: Kenneth Cabrera [mailto:krcabrer at epm.net.co] Sent: 29 November 2002 10:36 Cc: R-help at stat.math.ethz.ch Subject: [R] Obtaining the variable names of a glm object Hi, R users! Suppose I make a model like this: model1<-glm(resp~var1+var2+factor1+factor2+var1:factor1+var1:factor1+var2:factor2+var2:factor2,family=poisson) where "resp" is a response variable (poisson distributed) "var1" and "var2" are continuous variables and "factor1" and "factor2" are nominal variables (here I use them as...
2003 Mar 06
6
type III Sum Sq in ANOVA table - Howto?
Hello, as far as I see, R reports type I sums of squares. I'd like to get R to print out type III sums of squares. e.g. I have the following model: vardep~factor1*factor2 to get the type III sum of squares for factor1 I've tried anova(lm(vardep~factor2+factor1:factor2),lm(vardep~factor1*factor2)) but that didn't yield the desired result. Could anyone give me a hint how to proceed? thanks in advance Josef
2010 Apr 02
1
Selecting the first row based on a factor
Hello there, I have a situation where I would like to select the first row of a particular factor for a data frame (data example below). So that is, I would like to select the first entry when the factor1 =A and then the first row when factor1=B etc. I have thousands of entries so I need some general way of doing this. I have a minimal example that should illustrate what I am trying to do. I am using R version 2.9.2, ESS version 5.4 and Ubuntu 9.04. Thanks so much in advance! Sam #Minimal example...
2004 Jul 29
2
aov for unbalanced design (PR#7144)
...tion). The sum of squares for only for the second factor and total are computed correctly, but sum of squares for the first factor is computed incorreclty. Changing order of factors in the formula changes the ANOVA table. For the balanced design, there is no such problem. > summary(aov(data[1,]~factor1+factor2)) Df Sum Sq Mean Sq F value Pr(>F) factor1 5 1524420 304884 6.4529 0.0003229 *** factor2 7 1447830 206833 4.3776 0.0017808 ** Residuals 31 1464674 47248 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0...
2009 Dec 08
1
{Lattice} help.
...ing barchart() function from lattice package. The R code and data are below - code includes one for stack=TRUE and other for stack=FALSE. I would like to present the data in another form which would be plotting Factor3 levels (P, Q, R, S) as two stacked bars (side by side). Like, for each level of Factor1 there should be two bars: first bar showing stacked values of "P" and "Q" and the adjacent bar showing stacked values of "R" and "S". Is it possible using barchart() function? OR, if someone can give me some suggestions on the best way to present such data....
2010 Jun 06
1
Why did TukeyHSD not work when I used it for post-hoc for 2way within-subjects anova?
...ucted a psycholinguistic study that combined a 2 by 2 design and a latin square design. Specifically, I had 32 items each of which generated 4 conditions. Participants saw each of the 32 items only once: 8 in Condition A, 8 in B, 8 in C, and 8 in D. The table below serves as an example. *Subject* *Factor1* *Factor2* *Condition* *ReadingTime* *Item* 1 A A A 238 Item1 1 A A A 369 Item5 1 A A A 494 Item9 *.* *.* *.* *.* *.* *.* *.* *.* *. * *.* *.* *.* 1 B A C 294 Item22 1 B A C 694 Item26 *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* 8 A A A 334 Item3 8 A A A 366 Item7 *.* *.* *.* *.* *.* *.* *.* *....
2010 Jan 12
3
How to get minimum value by group
I'd like to get a long data set of minimum values from groups in another data set. The following almost does what I want. (Note, I'm using the word factor differently from it's meaning in R; bad choice of words) myframe = data.frame(factor1 = rep(1:2,each=8), factor2 = rep(c("a","b"),each=4, times=2), factor3 = rep(c("x","y"),each=2, times=4), y=1:16) attach(myframe) minimums = by(y, list(factor1, factor2,factor3), min) detach(myframe) The problem is that "minimums" is object of class...
2006 Aug 16
2
adding multiple fitted curves to xyplot graph
Hello RHelpers, This may already have been answered, but despite days of scouring through the archives I haven't found it. My goal is to add multiple fitted curves to a plot. An example data set (a data frame named df in following code) is: x1 y1 factor1 4 1298.25 0.00000000 1 5 1393.25 0.00000000 1 6 1471.50 0.04597701 1 7 1586.70 2.56908046 1 8 1692.10 11.14080460 1 9 1832.55 45.50459770 1 10 1928.30 65.56000...
2009 Dec 03
2
(Grouped + Stacked) Barplot
Hi All, I have googled and tried finding if someone has ever tried producing (Grouped + Stacked) Barplot. I couldn't find one. My data needs to be reshaped, but once it is done it would be something like this: Factor1 Factor2 Factor3 Value A X P 10 A X Q 20 A Y P 20 A Y Q 5 A Z P 20 A Z Q 10 B X P 20 B X Q 10 B Y P 30 B Y Q 50 B Z P 10 B Z Q 20 There are three categorical variables (Factor1, Fact...
2009 Jul 30
3
What is the best method to produce means by categorical factors?
I am attempting to replicate some of my experience from SAS in R and assume there are best methods for using a combination of summary(), subset, and which() to produce a subset of mean values by categorical or ordinal factors. within sas I would write proc means mean data=dataset; class factor1 factor2 var variable1 variable2; RUN; producing an output with means for each variable by factor groupings as below: *factor1 factor2 obs variable mean* Level A treatmentA 3 variable1 10 variable2 22...
2009 Aug 11
3
loadings function (PR#13886)
Full_Name: Mike Ulrich Version: 2.9 OS: Mac OSX Submission from: (NULL) (69.169.178.34) The help documentation for loadings() lists more then one parameter. The function call only expects one parameter. The digits, cutoff, and sort parameters are not used in the function. ## S3 method for class 'loadings': print(x, digits = 3, cutoff = 0.1, sort = FALSE, ...) ## S3 method for class
2007 Dec 20
0
test for factor effect with nested glm
Dear all, I use a nested design with lm and glm, with factor2 nested within factor1. In order to test for the significance of both factors, I use anova tables on the obtained models such as follows: /> mod1<-lm(A~factor1/factor2) > amod1<-anova(mod1, test="F") Analysis of Variance Table Response: A Df Sum Sq Mean Sq F value Pr(>F)...
2007 Sep 27
2
center option of basehaz in survfit
...what the centering option in basehaz does to factors. (basehaz computes the baseline cumulative hazard for a coxph object using the Breslow estimator). Lets say I'm interested in a survival model with two (dichotomous) factors and a continuous covariate. Variable Possible Values Factor1 0 or 1 Factor2 0 or 1 Covariate 0 to 100 I fit my model: modelname <- coxph(Surv ~ Factor1 + Factor2 + Covariate, data = data) If I then ask for: baselineA <- basehaz(modelname, centered=FALSE) I am fairly certain that baselineA will provide me with...
2009 Mar 31
3
Factor Analysis Output from R and SAS
...10 1.0000000 0.9473451 #v6 0.4086076 0.4326113 0.4320310 0.4323259 0.9473451 1.0000000 factanal(m1, factors=3) # varimax is the default # Output from R #Call: #factanal(x = m1, factors = 3) #Uniquenesses: # v1 v2 v3 v4 v5 v6 #0.005 0.101 0.005 0.224 0.084 0.005 #Loadings: # Factor1 Factor2 Factor3 #v1 0.944 0.182 0.267 #v2 0.905 0.235 0.159 #v3 0.236 0.210 0.946 #v4 0.180 0.242 0.828 #v5 0.242 0.881 0.286 #v6 0.193 0.959 0.196 # Factor1 Factor2 Factor3 #SS loadings 1.893 1.886 1.797 #Proportion Var 0.316 0.314 0.300 #Cumul...
2010 Apr 14
1
what is the intercept of a two-way anova model without interaction term?
Dear list, I have a question regarding the meaning of intercept term in a two-way anova model without interaction term. for example (let's assume there is no interaction between factor1 and factor2) : > df         val        factor1 factor2 1  48.61533       A      t1 2 171.13535       B      t1 3  65.96884       C      t1 4  63.71222       A      t2 5  80.22049       B      t2 6  96.95929       C      t2 7  38.70078       A      t3 8  99.44787       B      t3 9  36.58818     ...
2009 Dec 07
2
column statistics
Hi everybody, I would like to compute the mean for 1 variable between the rows with the same levels. For example, with the dataset below: Factor1 Factor2 Value A X 1 A X 2 A Y 3 A Y 4 B X 5 B X 6 B Y 7 B Y 8 I...