Displaying 20 results from an estimated 93865 matches for "means".
2005 Nov 30
8
Solving Systems of Non-linear equations
I am trying to write a function that will solve a simple system of
nonlinear equations for the parameters that describe the beta
distribution (a,b) given the mean and variance.
mean = a/(a+b)
variance = (a*b)/(((a+b)^2) * (a+b+1))
Any help as to where to start would be welcome.
--
Scott Story
Graduate Student
MSU Ecology Department
319 Lewis Hall
Bozeman, Mt 59717
406.994.2670
sstory at
2009 Aug 24
1
how to add 95% confidential interval as vertical lines to x axe in density plot
Dear R-help listers,
I want to add 95% confidential interval as vertical lines to x
axe in density plot. I have found the library(hdrcde) can do this
work, but I do not know
how to handle functions of this library when I used ggplot2 to draw the graph.
Thank you in advance.
The data and codes followed:
# dummy data
factor<-rep(c("Alice","Jone","Mike"),each=100)
2009 Aug 21
0
how to plot 95% confidential interval as vertical lines to x axe in density plot
Dear R-help listers,
Under the helps from the ggplot2 list, I have set up method of drawing
a graph with multiple density plots arranged one by one in one page.
Now, I want to add 95% confidential interval as vertical lines to x
axe in density plot. I have found the library(hdrcde) can do this
work, but I do not know
how to handle functions of this library when I used ggplot2 to draw the graph.
2010 Jun 09
4
question about "mean"
Hi there:
I have a question about generating mean value of a data.frame. Take
iris data for example, if I have a data.frame looking like the following:
---------------------
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4
0.2 setosa
2 4.9 3.0 1.4
0.2
2011 Oct 18
1
Repeat a loop until...
Dear all,
I know there have been various questions posted over the years about loops but I'm afraid that I'm still stuck. I am using Windows XP and R 2.9.2.
I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.]
> datamat <-
2006 Oct 27
3
Marginal Effect larger than 1 for a binary variable (summary.Design after lrm)
Dear All:
I run a logistic regression (using lrm in the Design package), and
after that, I use the command "summary" to get the marginal effects
of each variable. But one strange thing happens on my binary
dependent variable: The marginal effect of it jumping from 0 to 1 is
1.77. I believe the marginal effect of binary variable x1 has
interpretation should be P(Y=1|x1=1,
2009 Apr 14
1
mean fold change issues and p values
I am new to R and have two scripts written slightly different but should to relatively the same thing but my lack of experience with the program I can not figure out the what I need to do to correct it. The first script gives me a consistent mean fold change values with every run but can generate negative p values for some. For the second version of the script, the fold changes seem to be very
2016 Apr 14
4
Bug in by() function which works for some FUN argument and does not work for others
Dear Sirs,
I am Professor at Indira Gandhi Krishi Vishwavidyalaya, Raipur,
Chhattisgarh, India.
While taking classes, I found the *by() *function producing following error
when I use FUN=mean or median and some other functions, however,
FUN=summary works.
Given below is the output of the example I used on a built-in dataset
"mtcars", along with error message reproduced herewith:
>
2010 May 26
2
How to calculate mean of means
I have 3 columns of numbers, and i want to find the mean of each
separately, and then the mean of all of the means.
ive tried:
av3daysB<- mean(mean(avr1), mean(avr2), mean(avr3))
av3daysB
but it only gives me the mean of the first column (avr1)
Any suggestions?
Thanks,
Emilija
2024 Mar 26
2
Printout and saved results
How can I have both printout and saved results at the same time.
The subroutine first return "out" and the printout gets printed, but not
saved.
I then run the "invisible" line. Results got saved and accessible but no
printout.
How can I have both printout and also have the results saved? Thank you!
> dstat4 <- function(data,digits=3){
+?? Mean??? <-
1999 Nov 24
1
Need help..
Dear All,
I am trying to generate some Pareto random variates
using the inverse method. This is really straightfoward
and my R function looks as below :
pareto <- function(c, a, cnt=1000)
{
u <- runif(cnt)
x <- (c / ((u ^ (1 / a))))
mean.theo <- ((c * a) / (a - 1))
mean.gen <- mean(x)
cat('Pareto mean : theoritical', mean.theo,
'generated', mean.gen,
2020 Sep 21
2
Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"
Hello everyone,
I am using *mlogit* to analyse my choice experiment data. I have *3
alternatives* for each individual and for each individual I have *9
questions*. I have a response from *516 individuals*. So it is a panel of
9*516 observations. I have arranged the data in long format (it contains
100 columns indicating different variables and identifiers).
In mlogit I tried the following
2016 Apr 15
4
Bug in by() function which works for some FUN argument and does not work for others
...9752620740
Email: akhileshsingh.igkv at gmail.com
On Fri, Apr 15, 2016 at 3:06 AM, Adrian Du?a <dusa.adrian at unibuc.ro> wrote:
> I think you are not using the best function for what your intentions are.
> Try:
>
> > by(data=mtcars, INDICES=list(as.factor(mtcars$am)), FUN=colMeans)
> : 0
> mpg cyl disp hp drat wt
> qsec vs
> 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947
> 18.1831579 0.3684211
> am gear carb
> 0.0000000 3.2105263 2.73684...
2005 Aug 04
1
Where the error message comes from?
...all groups
# sb2 = Between group variance
# sw2 = Within group variance
# r = Corelation coefficient
# z = standard normal variate cutoff value for binomial rv
# Simulate the random effects
A = rnorm(n=k, mean=0, sd=sqrt(sb2))
# Work out the mean of each group of data
means = matrix(mu, nrow=k,ncol=1)
for(row in 1:k){
means[row] = means[row,1] + A[row]}
# Initializing the data vectors
g=c=c1=mu1=numeric(k*m)
# Now generate the data one group at a time.
ind=0
for(u in 1:k){
for(replicate in 1:m){
ind = ind + 1
x=r...
2011 Sep 15
1
Questions on 'lme' function, urgent!
Hi Dear all,
I have some gene expression data samples from different tissue types
-----------------------------------------------
- 120 samples from blood (B)
- 20 samples from Liver (L)
- 15 samples from Kidney (K)
- 6 samples from heart (H)
-----------------------------------------------
All the samples are from different individuals, so there are in total 161
individuals from which the DNA was
2008 Feb 21
1
anova power calculations
...ly
appreciated.
I'm working now on a similar problem, but instead of a balanced ANOVA, I
have an unbalanced one. The first part of the question was:
You assume that the within-population standard deviations all equal 9. You
set the Type 1 error rate at รก = .05. You presume that the population means
will have the following values: uA = 17.5, uB = 19, uC = 25, and uD = 20.5.
You intend to run 80 subjects in all, with equal n's across all 4 groups.
You plan on conducting a one-way ANOVA. Compute your power to reject the
null hypothesis under these conditions.
I did:
within.var = 9 ^ 2
mean...
2009 Jul 07
2
Multiplication of data frame with vector
...4594 3890 4096 4019 4204
M447T90 26553 27647 26889 26751 26929
Now I'm trying to transform each value column-wise to make columns to all have the same mean with:
df * mean(mean(df)) / mean(df).
I just can't get my head around this: mean(df) gives me the correct column means vector, and mean(mean(df)) gives me the correct total mean. The above operation works correctly for individual rows, i.e. if I do
df[1,]*mean(mean(df))/mean(df)
Can someone tell me what I am doing wrong??
Thanks!
2003 May 28
1
Numbers that look equal, should be equal, but if() doesn't see as equal (repost with code included)
...mean.bins <- function(data)
{
# For the vincentizing procedures in vincentize() and binify(),
# it made sense to check the data array/vector/matrix. Here,
# we now just need to check that data is a matrix.
if ( !is.matrix(data) )
{
stop("The data is not in matrix form.");
}
means <- c();
bins <- dim(data)[1];
for (i in 1:bins)
{
means <- c(means, mean(data[i,]));
}
# return a vector of means.
means;
}
bins.factor <- function(data, bins)
{
if ( !is.data.frame(data) )
{
stop("data is not a data frame.");
}
source('Ratcliff.r', lo...
2009 Mar 10
6
Pseudo-random numbers between two numbers
I would like to generate pseudo-random numbers between two numbers using
R, up to a given distribution,
for instance, rnorm.
That is something like rnorm(HowMany,Min,Max,mean,sd) over
rnorm(HowMany,mean,sd).
I am wondering if
dnorm(runif(HowMany, Min, Max), mean, sd)
is good. Any idea? Thanks.
-james
2017 Sep 09
2
Avoid duplication in dplyr::summarise
Dear group,
Is there a way I could avoid the sort of duplication illustrated below?
i.e., I have the same dplyr::summarise function on different group_by
arguments. So I'd like to create a single summarise function that could be
applied to both. My attempt below fails.
df <- data.frame(matrix(rnorm(40), 10, 4),
f1 = gl(3, 10, labels = letters[1:3]),
f2 =