search for: mymean

Displaying 20 results from an estimated 20 matches for "mymean".

2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9. I've been experimenting with plotmath. I wish it were easier to combine expressions in plotmath with values from the R program itself. There are two parameters in the following example, the mean "mymean" and standard deviation "mystd". I am able to use bquote to write elements into the graph title like mu = mymean and R will plot the symbol "mu" and the value of mymean from the program. But I want to combine that result in a string along with other results. Can I combi...
2008 Jul 08
6
Question: Beginner stuck in a R cycle
...surements are given and an column named Pr_mean, with no values. I would like to set a cycle to compute the average of prevalence values for each different code and store the averages under the empty field Pr_mean. This is what I wrote: # Set a cycle for (i in 1:nrow(myD)) { mycode = myD$code[i] mymean[i] = mean(prevalence) myD$Pr_mean[i] = mymean[i] } With the above cycle I am able to compute the average of all 200 observations which is then written in every cell. I understand that a condition is missing, that indicates that the average has to be computed amongst the observations showing the s...
2007 Feb 23
1
how to use apply with two variables
Hi, this is a made-up example. Function "myfun" returns two arguments. Can "apply" be used so that "myfun" is called only once? Thanks Serguei mat<-matrix(runif(50),nrow=10,ncol=5) myfun<-function(x) { mymean<-mean(x) mysd<-sd(x) return(mymean,mysd) } out1<-t(apply(mat,1,function(x) myfun(x)$mymean)) out2<-t(apply(mat,1,function(x) myfun(x)$mysd)) [[alternative HTML version deleted]]
2010 Jun 23
2
About normality tests...
...eld, 2005). I have a few questions to ensure that I am using them right. 1) The Shapiro-Wilk test requires to provide mean and sd. Is is correct to add here the mean and sd of the data itself (since I am comparing to a normal distribution with the same parameters) ? mySD <- sd(mydata$myfield) myMean <- mean(mydata$myfield) shapiro.test(rnorm(100, mean = myMean, sd = mySD)) 2) If I just want to test each distribution individually, I assume that I am doing a one-sample Kolmogorov-Smirnov test. Is that correct? 3) If I simply want to know if normality exists or not, what should I put for the...
2009 Sep 25
1
R CMD INSTALL --build: Folders /inst and /etc not in zip-file and WindowsXP locks /library/[package]/etc/
..." subdirectory is lost, too. I tried a simplified "test" package. The "test" package has the following structure (see also attachement: "test" package as source file): /test |---/inst | |---/etc | |---menus.txt | |---/man | |---mymean.Rd | |---test-package.Rd | |---/R | |---mymean.R | |---NAMESPACE |---DESCRIPTION The file "menus.txt" (inspired by the Rcmdr menu structure) contains one single comment line. The file "mymean.R" contains a simple function that computes the mean....
2007 Feb 09
2
plotting derived values not raw
I am trying to plot the mean and standard error of three separate conditions. For various reasons, I do not have access to the raw data from which the mean and error were derived and would like to make error bar plots utilizing only the actual mean and standard error values. Is there a way to do this in R? Thanks for any help in advance. james [[alternative HTML version deleted]]
2007 Jul 07
1
calculating p-values of columns in a dataframe
...ot;differences of means". I wish to test whether these differences are significantly different from zero. Below, I calculate the t-statistic for each column. What is a "good" method to calculate/look-up the p-value for each column? mydf=data.frame(a=c(1,-22,3,-4),b=c(5,-6,-7,9)) mymean=mean(mydf) mysd=sd(mydf) mynn=sapply(mydf, function(x) {sum ( as.numeric(x) >= -Inf) }) myse=mysd/sqrt(mynn) myt=mymean/myse myt --------------------------------- Food fight? Enjoy some healthy debate [[alternative HTML version deleted]]
2010 Jun 29
1
Sweave, xtable plus/minus sign
...12pt]{article} \usepackage[italian]{babel} \usepackage{amssymb} \usepackage[utf8x]{inputenc} \usepackage[pdftex]{graphicx} \begin{document} <<label=test, echo=FALSE, results=tex>>= df.data1 <- cbind.data.frame(A = rnorm(18), B =factor(rep(LETTERS[1:6], each=3))) myMean <- tapply(df.data1$A, df.data1$B, FUN = mean) mySD <- tapply(df.data1$A, df.data1$B, FUN = sd) foo <- matrix(c(myMean, mySD), ncol=2, nrow=6) colnames(foo) <- c("Mean", "Std.Dev") tmpTable <- xtable(foo, caption ="Simulated data", label="tab:fo...
2012 Jun 15
0
argument "x" is missing, with no default - Please help find argument x
...d.table[2,1] falseneg<-pred.table[1,2] sumvar<-epi.tests(c(truepos, falsepos , falseneg, trueneg), verbose=T) epi.tests(c(truepos, falsepos , falseneg, trueneg), verbose=F) # Calculate the overall accuracy. cv.evaluate$correct <- cv.evaluate$prediction == cv.evaluate$remitter mymean<-mean(cv.evaluate$correct) retlist<-data.frame(mtry, sumvar$se, sumvar$sp, mean(cv.evaluate$correct)) return(retlist) } subloop<- function(mtry=mtry, ml.frame=ml.frame, ntrees=ntrees) { nfolds<- 10 # shuffle the numbers and divide into 10 groups numberOfRows<-dim(ml.frame)...
2004 Apr 01
5
boot question
What in the world am I missing?? > x<-rnorm(20) > mean(x) [1] -0.2272851 > results<-boot(x,mean,R=5) > results[2] $t [,1] [1,] -0.2294562 [2,] -0.2294562 [3,] -0.2294562 [4,] -0.2294562 [5,] -0.2294562 Jeff Morris Ortho-Clinical Diagnostics A Johnson & Johnson Co. Rochester, NY Tel: (585) 453-5794 [[alternative HTML version deleted]]
2008 Mar 06
3
1-pnorm values in a table
Hi, I've read in a csv file (test.csv) which gives me the following table: Hin1 Hin2 Hin3 Hin4 Hin5 Hin6 HAI1 9534.83 4001.74 157.16 3736.93 484.60 59.25 HAI2 13272.48 1519.88 36.35 33.64 46.68 82.11 HAI3 12587.71 5686.94 656.62 572.29 351.60 136.91 HAI4 15240.81 10031.57 426.73 275.29 561.30 302.38 HAI5 15878.32 10517.14 18.93 22.00 16.91
2010 Aug 13
2
Lattice xyplots plots with multiple lines per cell
Hello, I need to plot the means of some outcome for two groups (control vs intervention) over time (discrete) on the same plot, for various subsets such as gender and grade level. What I have been doing is creating all possible subsets first, using the aggregate function to create the means over time, then plotting the means over time (as a simple line plot with both control & intervention
2006 Apr 20
1
Bootstrap error message: Error in statistic(data, origina l, ...) : unused argument(s) ( ...) [Broadcast]
...? Sure, you don't get any error, but have you checked whether any bootstrapping was actually done? Most of those functions are generics, thus having the "..." argument that can take anything. Doesn't mean they will be used. See if the following helps: > x <- 1:10 > myMean <- function(x, idx) mean(x[idx]) > library(boot) > x.boot <- boot(x, mean, R=10) > str(x.boot) List of 11 $ t0 : num 5.5 $ t : num [1:10, 1] 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 $ R : num 10 $ data : int [1:10] 1 2 3 4 5 6 7 8 9 10 $ seed : int [1:...
2008 Apr 14
3
Power curves
Hi, I am trying to create a power curve to show how the power of a t-test varies depending on the mean. Any ideas how I should go about this? Louisa _________________________________________________________________ [[alternative HTML version deleted]]
2011 Mar 15
2
Calculate monthly means
I am trying to calculate monthly means by year of phosphates and nitrates from a multi year data set. Can anybody help me out with the most effective way to do this? My data looks like this: Collection_Date                   Test.Name              Value 2000-01-24 17:00:00            Phosphate               0.108 2000-01-24 17:00:00            Nitrate                     0.037 2001-11-12
2010 Jan 05
5
mean for subset
Hello, does anyone know how to take the mean for a subset of observations? For example, suppose my data looks like this: OBS NAME SCORE 1 Tom 92 2 Tom 88 3 Tom 56 4 James 85 5 James 75 6 James 32 7 Dawn 56 8 Dawn 91 9 Clara 95 10 Clara 84 Is there a way to get
2008 Oct 17
2
function help
Hi everyone, I have dataset which I make a sample of it couple of times and each time I get the mean and standard deviation of each row for each sample. I have a function for that, which takes the name of the file and number of times to sample and then returns the mean and standard deviation for each row in each sample. Sample=function(name, n){
2018 Nov 08
0
An update on the vctrs package
...e obvious "R" for real). It's difficult for an R function to determine the input types of another R function and even more difficult to determine the output types. It may be possible to incorporate a comment as a variable (inside a function) rather than a comment as a comment. > mymean = function (x) + { #info + .map = "f: Nn -> N1" + + mean (x) + } kind regards Abs
2003 Nov 16
1
na.rm default
Is there a way to set "na.rm=TRUE" as a default, so that this does not have to be re-specified for all of the functions requiring this option? Thanks in advance, Stephanie Broyles sbroyl@lsuhsc.edu [[alternative HTML version deleted]]
2012 May 15
4
reading data into R
Hi I am really new using R, so this is really a beginner stuff! I created a very small data set on excel and then converted it to .csv file. I am able to open the data on R using the command "read.table ("mydata1.csv", sep=",", header=T)" and it just works fine. But when I want to work on the data (e.g. calculate the mean of variable "X") R says