similar to: Mean according to the combination of two factors

Displaying 20 results from an estimated 30000 matches similar to: "Mean according to the combination of two factors"

2017 Jun 01
2
subletting an array according to dimnames
Hi all, I have a three dimensional array with the corresponding dimension names. I would like to subset the array according to the dimension names. For example, suppose I want to extract the values corresponding to A=20, B=10, C=0. I know I can do: P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dimnames(P2)$C==0] But is there a better way for doing this? Thanks for your help! Hanna >
2017 Jun 02
0
subletting an array according to dimnames
Have you tried P2["20", "10", "0"] ? Jean On Thu, Jun 1, 2017 at 3:10 PM, li li <hannah.hlx at gmail.com> wrote: > Hi all, > I have a three dimensional array with the corresponding dimension names. > I would like to subset the array according to the dimension names. For > example, > suppose I want to extract the values corresponding to A=20,
2018 Feb 06
1
question with integrate function
Hi Hanna, your function is essentially zero outside a short interval around 9. And the help page states: "If the function is approximately constant (in particular, zero) over nearly all its range it is possible that the result and error estimate may be seriously wrong." You could try to integrate over a finite interval, say (7, 12). G?ran Brostr?m On 2018-02-06 19:40, li li wrote:
2013 Mar 14
4
plotting
Hi alL, I have a data frame with 4 columns: "value", "time", "group" and "id". I would like to plot "value" vs. "time" with different colors for different levels of "group" and different symbols for different values of "id". I think I could do this but I would like to see what is an easier way to plot the
2018 Feb 06
2
question with integrate function
Hi all, The function h below is a function of c and it should be a monotone increasing function since the integrand is nonnegative and integral is taken from c to infinity. However, as we can see from the plot, it is not shown to be monotone. Something wrong with the usage of integrate function? Thanks so much for your help. Hanna h <- function(c){ g <- function(x){pnorm(x-8.8,
2018 Feb 06
0
question with integrate function
Sorry. I meant in the previous email that the function h() is a monotone decreasing function. Thanks very much. 2018-02-06 13:32 GMT-05:00 li li <hannah.hlx at gmail.com>: > Hi all, > The function h below is a function of c and it should be a monotone > increasing function since the integrand is nonnegative and integral is > taken from c to infinity. However, as we can see
2014 Jun 24
2
Making several plots using a loop function
Hi all, When making a bunch of plots using a loop function, how to add title to reflect different plots. Specifically, for the code below, I generated 9 plots. I would like to add a title to each plot. For example, the titles will be respectively, plot1, plot 2, … plot 9. Thank you very much! Hanna par(mfrow=c(3,3), pty="s", pch=16, col="blue") for ( i in 1:9) { lm1
2017 Jun 01
2
Question on function "scatterplot3d"
Hi all, I have a question with regard to making plots using function "scatterplot3d". Please see the example below. It looks like, for y axis, the tickmark text was cutoff. The number "10" does not show up completely. I tried to work with par(mpg). It does not seem to work. Hope to get some advice here. Thanks much! Hanna C <- runif(30) B <- rep(1:3, each=10) A
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and z3 which is captured by "z" and "prob" as described below. For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13. Also, the probability adds up to 1. > head(z) z1 z2 z3 [1,] -0.46667 -1.0000 -1.0000 [2,] -0.33333 -0.9333 -0.9333 [3,] -0.20000 -0.8667 -0.8667
2017 Jun 01
0
Question on function "scatterplot3d"
> On 1 Jun 2017, at 03:41, li li <hannah.hlx at gmail.com> wrote: > > Hi all, > I have a question with regard to making plots using function > "scatterplot3d". > Please see the example below. It looks like, for y axis, the tickmark text > was cutoff. > The number "10" does not show up completely. I tried to work with par(mpg). > It does not
2017 Jun 07
3
Adding zeros in each dimension of an array
For a data frame, we can add an additional row or column easily. For example, we can add an additional row of zero and an additional row of column as follows. Is there an easy and similar way to add zeros in each dimension? For example, for array(1:12, dim=c(2,2,3))? Thanks for your help!! Hanna > x <- as.data.frame(matrix(1:20,4,5))> x[5,] <- 0> x[,6] <- 0> x V1 V2
2017 Jul 28
0
problem with "unique" function
Most likely, previous computations have ended up giving slightly different values of say 0.13333. A pragmatic way out is to round to, say, 5 digits before applying unique. In this particular case, it seems like all numbers are multiples of 1/30, so another idea could be to multiply by 30, round, and divide by 30. -pd > On 28 Jul 2017, at 17:17 , li li <hannah.hlx at gmail.com> wrote:
2013 Mar 05
2
Error message
Dear all, I got an error message when running the following code. Can anyone give any suggestions on fixing this type of error? Thank you very much in advance. Hanna > integrand <- function(x, rho, a, b, z){ + x1 <- x[1] + x2 <- x[2] + Sigma <- matrix(c(1, rho, rho, 1), 2,2) + mu <- rep(0,2) + f <-
2013 Apr 23
1
lmer with only random effect
Dear all, I want to fit a random effect model with only one random factor. I do not want to include the intercept term either. The model I using now is lmer(values ~ (1|lot), data=tmp) The results are as below. How do I take out the intercept term? Or if this is not possible for the lmer function, is it possible using lme function in the "nlme" package? Thank you very much in
2013 Sep 07
1
Change color of the boxplot outliers
Hi all, Is there a way to change the color of the boxplot plots outliers? Thanks. Hanna [[alternative HTML version deleted]]
2013 Feb 01
1
Question on "plotCI" function
Hi all, In my plotCI function, the argument x is chosen to be seq(0.05, 0.95, by=0.05). However, when I make the plot, the plot has the x coordinate goes 1:19. Does anyone know how to make the x coordinate to be (0,0.5, 0.1, ..., 0.95). Thank you. Hanna [[alternative HTML version deleted]]
2017 Oct 30
1
An iterative function
Dear all, The function f() below is a function of m1 and m2, both of which are matrices with 3 rows. The function works sequentially one row after another. So altogether there are three stages. I am trying to update the coding to write a generic function that will work for arbitrary k stages. I am hoping to get some suggestion and help. Thanks so much! Hanna ##x, y are two
2017 Jun 01
2
[FORGED] Re: Question on function "scatterplot3d"
On 01/06/17 13:17, Ismail SEZEN wrote: > >> On 1 Jun 2017, at 03:41, li li <hannah.hlx at gmail.com> wrote: >> >> Hi all, >> I have a question with regard to making plots using function >> "scatterplot3d". >> Please see the example below. It looks like, for y axis, the tickmark text >> was cutoff. >> The number "10"
2017 Jun 07
3
An R question
Hi all, In checking my R codes, I encountered the following problem. Is there a way to fix this? I tried to specify options(digits=). I did not fix the problem. Thanks so much for your help! Hanna > cdf(pmass)[2,2]==pcum[2,2][1] FALSE> cdf(pmass)[2,2][1] 0.9999758> pcum[2,2][1] 0.9999758 [[alternative HTML version deleted]]
2012 Aug 17
3
Apply a function according to factor levels.
Dear all, I have a question on applying a function to the data according to factor levels. For example, for the data below, what is the best way to apply a function to "values" according to different levels of "samples" (1,2,3,4,5)? values ind sample 1 0.03325 1 1 2 0.03305 1 1 3 0.03185 1 1 4 0.03515 1 1 5 0.03375 1 1 6 0.01180