search for: y2

Displaying 20 results from an estimated 1128 matches for "y2".

2013 Mar 17
3
help with simple function
hello all I am writing a quite simple script to study dental wear patterns in humans and I wrote this function sqrt(var(Y1)+var(Y2))^2-4(var(Y1)*(var(Y2)-cov(Y1,Y2)^2)) but appear this error message Error: attempt to apply non-function alternatively I wrote this sqrt(var(Y1)+var(Y2)^2)-4[(var(Y1)*(var(Y2)-cov(Y1,Y2)^2))] but this error message appear [1] NA Warning message: NAs introduced by coercion some suggestion to s...
2008 Jan 29
3
How to get two y-axises in a bar plot?
Hi, I have measured two response variables (y1, y2) at each treatment level (x = 0, 1.5 or 3). Now I would like to show the y1 and y2 against x in a bar plot. However, y1 and y2 differ in scale so I need two y-axises, one on the left side and one on the right side (and I dont want to standardize my responses). This is fairly easy if you want to...
2008 Feb 27
4
plot y1 and y2 on one graph
Dear all I have a code like x<-1:10 y1<-x+runif(10)*2 y2<-seq(0,50,length.out=10)+rnorm(10)*10 par(mfrow=c(1,2)) plot(y1~x) plot(y2~x) Now I would like to plot y1 and y2 on the same graph, with its two scales (y1 on left and y2 on rigth side). Any help are welcome. Kind regards Miltinho Brazil [[alternative HTML version deleted]]
2006 Mar 10
1
add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
Although this should be trivial, I'm having a spot of trouble. I want to make a lattice plot of the format y1+y2 ~ x | grp but then fit a lm to each y variable and add an abline of those models in different colors. If the xyplot followed y~x|grp I would write a panel function as below, but I'm unsure of how to do that with y1 and y2 without reshaping the data before hand. Thoughts appreciated. -Andy fo...
2003 Mar 04
4
writing several command line in R console
...breaking the continuity of my code more clearly : if for example I write a function, so far i have to write the all code inside on the same line wich may become obscure as the function is more and more complex. I would like to do like in the example of the manuels: >twosam <- function(y1, y2) { n1 <- length(y1); n2 <- length(y2) yb1 <- mean(y1); yb2 <- mean(y2) s1 <- var(y1); s2 <- var(y2) s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2) tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2)) tst } all I can do is something like that: >twosam <-...
2011 Aug 15
1
update() ignores object
...tracting the name of the term in a regression model that dropterm specifies as the least significant one, and I'm assigning this name to an object. However, when I use update(), it ignores this object. Is there a way I can make it not ignore it? A reproducible example is below: > lm(x1~1+y1*y2+y3+y4,data=anscombe)->my.lm > rownames(dropterm(my.lm,test="F",sort=TRUE))[1]->my.object > my.object [1] "y1:y2" > update(my.lm,.~.-my.object) Call: lm(formula = x1 ~ y1 + y2 + y3 + y4 + y1:y2, data = anscombe) Coefficients: (Intercept) y1 y2...
2011 Jan 19
2
Reshape
Hi - I'm up against a complicated reshape problem. I have data of the form X1,Y1,hr1,hr2,hr3 X1,Y2,hr1,hr2,hr3 X1,Y3,hr1,hr2,hr3 X2,Y1,hr1,hr2,hr3 X2,Y2,hr1,hr2,hr3 X2,Y3,hr1,hr2,hr3 where X and Y are factors and the hr(1,2,3) are values. I need it as ,X1, X2 Y1,hr1,hr1 Y1,hr2,hr2 Y1,hr3,hr3 Y2,hr1,hr1 Y2,hr2,hr2 Y2,hr3,hr3 .., Any hints? I've been at it for hours. p -- View this m...
2004 Jun 05
2
More than one series in a coplot
Hi! I would like to know, how do you plot more than one data series when using "coplot"? I think I know the answer if "plot" is being used: x <- 1:10 y <- 1:10 y2 <- 1:10* 1.1 plot ( y ~ x, type="n" ) points( y ~ x, type = "b", col = "red" ) # plot the points and lines for the first series points( y2 ~ x, type = "b", col = "blue" ) # plot the points and lines for the second series But how should it be...
2007 Jan 30
2
Rbind for appending zoo objects
Hi R, y1 <- zoo(matrix(1:10, ncol = 2), 1:5) colnames(y1)=c("a","b") y2 <- zoo(matrix(rnorm(10), ncol = 2), 6:10) colnames(y2)=c("b","a") > y1 a b 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 > y2 b a 6 0.9070204 0.3527630 7 1.2405943 0.8275001 8 -0.1690653 -0.1724976 9 -0.6905223 -1.1127670 10 0....
2004 Nov 17
1
how to estimate conditional density
Hi, there. Suppose I have a bivariate data set y1 and y2. Can anybody tell me how to estimate the conditional density of f(y1|y2) and vice versa? Thanks. Yulei $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Yulei He 1586 Murfin Ave. Apt 37 Ann Arbor, MI 48105-3135 yuleih at umich.edu 734-647-0305(H) 734-763-0421(O) 734-763-0427(O) 734-764-8263(fax) $$$$$$$$$...
2013 Apr 08
3
Reshaping a table
Hello all, I have data in the form of a table: X Y1 Y2 0.1 3 2 0.2 2 1 And I would like to transform in the form: X Y 0.1 Y1 0.1 Y1 0.1 Y1 0.1 Y2 0.1 Y2 0.2 Y1 0.2 Y1 0.2 Y2 Any ideas how? Thanks in advance, IOanna [[alternative HTML version deleted]]
2010 Dec 07
4
Creating binary variable depending on strings of two dataframes
...;,"342","13") x2=c("1","1","1","0","0") data1=data.frame(x1,x2) y1=c("232","232","3454","3454","3455","342","13","13","13","13") y2=c("E1","F3","F5","E1","E2","H4","F8","G3","E1","H2") data2=data.frame(y1,y2) I need a new column in dataframe data1 (x3), which is either 0 or 1 depending if the value "E1" in y2 of data2...
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
...means I can only call one test at a time. I thought I could get ride of this by adding "s" to test; in this case (tests=c(list)), I got Pillai test. Does this mean that Pillai would be the default test and summary(manova()) can only post one test at a time? > summary(manova(cbind(y1, y2) ~ z1, data = + ex7.8),test=c("Wilks","Roy","Pillai")) Error in match.arg(test) : 'arg' must be of length 1 > summary(manova(cbind(y1, y2) ~ z1, data = + ex7.8),tests=c("Wilks","Roy","Pillai")) Df Pillai approx F num...
2008 Oct 15
2
dynlm and lm: should they give same estimates?
...re not the same for what I think is the same model. I have just modified example 4.2 from the Pfaff book, please see below for the code and results. Can anyone tell my what I am doing wrongly? Many thanks, Werner set.seed(123456) e1 <- rnorm(100) e2 <- rnorm(100) y1 <- ts(cumsum(e1)) y2 <- ts(0.6*y1 + e2) lr.reg <- lm(y2 ~ y1) error <- ts(residuals(lr.reg)) error.lagged <- error[-c(99, 100)] dy1 <- diff(y1) dy2 <- diff(y2) diff.dat <- data.frame(embed(cbind(dy1, dy2), 2)) colnames(diff.dat) <- c('dy1', 'dy2', 'dy1.1', 'dy2.1'...
2009 Dec 01
1
Multiple grouping on the X axis.
...d the desired output. We have a jmp script that can do the same thing, but at ~$200 a year the licensing is counterproductive. Thanks for any help. Data input: Loaded from a CSV file. Physical_1 Logical_1 Logical_2 Data_1 Data_2 x Y Z2 54 56 x Y2 Z2 53 55 x Y3 Z2 52 54 x2 Y Z 60 58 x2 Y2 Z 59 57 x2 Y3 Z 58 56 x3 Y Z 56 53 x3...
2011 Aug 02
1
My R code is not efficient
Dear R users, I have two n*1 integer vectors, y1 and y2, where n is very very large. I'd like to compute elbp = 4^(y1) * 5^(y2) * sum_{i=0}^{max(y1, y2)} [{ (y1-i)! * (i)! * (y2-i)! }^(-1)]; that is, I need to compute "elbp" for each (y1, y2) pair. So I made R code like below, but I don't think it's efficient Would you plz...
2006 May 30
2
merging
Dear List, Given, y <- matrix(c(0,1,1,1,0,0,0,4,4), ncol = 3, byrow = TRUE) rownames(y) <- c("a","b","c") colnames(y) <- c("1","2","3") y y2 <- y[2:3, ] rownames(y2) <- c("x","z") y2 how can I stop merge(y, y2, all = TRUE, sort = FALSE) squishing the extra rows? Ideally I want the same as: rbind(y, y2) in this case. This is specific example of situation where two data matrices have same column variables an...
2010 Oct 17
1
lattice xyplot - formatting of multiple Y variables when using subgroups
Hi all, Using xyplot I want to print to Y variables (y1, y2) versus X, conditional on the group. How can I obtain a line (type="l") for one relationship (ie. y1 ~ x) and points (type="p") for the other (y2 ~ x) ? library(lattice) # create some sample data df<-data.frame(group=as.factor(c(rep("a",4), rep("b",4))),...
2012 Aug 22
3
Barplot with Secondary axis
...stered bar chart by using besides = True option in barplot function and my y coordinates are not plotted exactly at the center on each two bars. Please help me. I am pasting the code as follows. x = c("a","b","c","d") y= cbind(c(50,40,30,20),c(40,30,20,10)) y2 = c(0.80,0.65,0.75,0.50) barplot(t(y),beside = TRUE) par(new=T) plot(y2,,,type="o",col="black",lwd= 3,lty=1,xaxt="n",yaxt="n",xlab="",ylab="") points(y2,pch=20) I also tried following code for plotting the line point exactly at the cent...
2007 Oct 17
3
how to repeat the results of a generated probabilities
hello, I want to simulate 200 times the mean of a joint probability (y1) and 200 times the mean of another joint distribution (y2), that is I'm expecting to get 200 means of y1 and 200 means of y2. y1 and y2 are probabilities that I calculate from the marginal prob. (z1 and z2 respectively) multiple by the conditional prob. (x1 and x2 respectively), which I generaterd from the binomial distribution. here are the results f...