similar to: for loops and counter interpolation

Displaying 20 results from an estimated 1000 matches similar to: "for loops and counter interpolation"

2013 Nov 07
1
R interface to C API Rf_logspace_{add,sub}?
Is there an R-language interface to the R API C-language functions Rf_logspace_add() and Rf_logspace_sub()? I don't see one but I may not looking under the right name. Various packages have functions which do that same sort of thing (log(exp(x)+exp(y)) and log(exp(x)-exp(y)) without unnecessary floating point errors). They have names like matrixStats::logSumExp(lx, na.rm=FALSE, ...)
2012 May 26
1
Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves
Hi all, given this example #start a<-c(0,70,50,100,70,650,1300,6900,1780,4930,1120,700,190,940, 760,100,300,36270,5610,249680,1760,4040,164890,17230,75140,1870,22380,5890,2430) length(a) b<-c(0,0,10,30,50,440,1000,140,70,90,60,60,20,90,180,30,90, 3220,490,20790,290,740,5350,940,3910,0,640,850,260) length(b) out<-ks.test(log10(a+1),log10(b+1)) # max distance D
2006 Aug 07
3
Finding points with equal probability between normal distributions
Dear mailing list, For two normal distributions, e.g: r1 =rnorm(20,5.2,2.1) r2 =rnorm(20,4.2,1.1) plot(density(r2), col="blue") lines(density(r1), col="red") Is there a way in R to compute/estimate the point(s) x where the density of the two distributions cross (ie where x has equal probability of belonging to either of the two distributions)? Many Thanks Eleni
2009 Mar 12
3
help with predict and plotting confidence intervals
Dear R help, This seems to be a commonly asked question and I am able to run examples that have been proposed, but I can't seems to get this to work with my own data. Reproducible code is below. Thank you in advance for any help you can provide. The main problem is that I can not get the confidence lines to plot correctly. The secondary problem is that predict is not able to find my object
2006 Sep 25
2
Multiple imputation using mice with "mean"
Hi I am trying to impute missing values for my data.frame. As I intend to use the complete data for prediction I am currently measuring the success of an imputation method by its resulting classification error in my training data. I have tried several approaches to replace missing values: - mean/median substitution - substitution by a value selected from the observed values of a variable - MLE
2006 Jul 27
2
memory problems when combining randomForests [Broadcast]
You need to give us more details, like how you call randomForest, versions of the package and R itself, etc. Also, see if this helps you: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/32918.html Andy From: Eleni Rapsomaniki > > Dear all, > > I am trying to train a randomForest using all my control data > (12,000 cases, ~ 20 explanatory variables, 2 classes). > Because
2005 Feb 02
3
publishing random effects from lme
Dear all, Suppose I have a linear mixed-effects model (from the package nlme) with nested random effects (see below); how would I present the results from the random effects part in a publication? Specifically, I?d like to know: (1) What is the total variance of the random effects at each level? (2) How can I test the significance of the variance components? (3) Is there something like an
2006 Sep 11
1
summary(glm) for categorical variables
Dear list people Suppose we have a data.frame where variables are categorical and the response is categorical eg: my.df=NULL for(i in LETTERS[1:3]){my.df[[i]]=sample(letters, size=10)} my.df=data.frame(my.df) my.df$class=factor(rep(c("pos", "neg"), times=5)) my.glm=glm(class ~ ., data=my.df, family=binomial) summary(my.glm) .... Estimate Std. Error z
2006 Oct 29
0
Using predict.glm for classification
Dear R users, I'm trying to understand how to derive the actual predictions (in terms of class) using predict.glm. Consider this example: mydf=data.frame(A=sample(rnorm(1000), size=1000, replace=T), B=sample(rnorm(5), size=1000, replace=T), C=sample(rnorm(10), size=1000, replace=T), class=sample(c("a", "b"), size=1000, replace=T)) mydf.glm=glm(class ~ .^2, data=mydf,
2003 Oct 29
1
I have a problem with the log2 function
Dear R users, according the help(log), the function log2(x) should give the natural logarithm of x. I expect in case of x=2 to to get 0.6931, however, R gives me 1 as a result. Similar, logb(2,2) gives 1 again. I'm wondering if I have missed something ? Yours Frank -- Frank Mattes, MD e-mail: f.mattes at ucl.ac.uk Department of Virology fax 0044(0)207 8302854 Royal Free Hospital
2005 Oct 02
2
convering upper triangular matrix into vector
Hi I have two symmetrical distance matrices and want to compute the correlation coefficient between them (after turning them into vectors). Is there a way of selecting only the upper triangular part of each matrix, then convert this into a vector so I can compute the correlation? Many Thanks Eleni Rapsomaniki
2006 Sep 15
0
R: Grouping columns in a data frame based on the values of a column
Perhaps using 'ave' and 'cut': df <- data.frame(x=runif(100, 0.1, 1), y=rnorm(100, 0.2, 0.6)) df$xcut<-cut(df$x, seq(0, 1, 0.1)) df$z<-ave(df$y, df$xcut) df[order(df$x),] Stefano -----Messaggio originale----- Da: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]Per conto di e.rapsomaniki at mail.cryst.bbk.ac.uk Inviato: venerd? 15
2006 Sep 27
1
Any hot-deck imputation packages?
Hi I found on google that there is an implementation of hot-deck imputation in SAS: http://ideas.repec.org/c/boc/bocode/s366901.html Is there anything similar in R? Many Thanks Eleni Rapsomaniki
2005 Apr 11
1
extracting correlations from nlme
Hi, I would like to know how (if) I can extract some of the information from the summary of my nlme. at present, I get a summary looking something like this: > summary(fit.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: MLKYLD ~ W4(DIM, logA, B, C) Data: ADHIS.x0 AIC BIC logLik 265314 265401.6 -132647 Random effects: Formula: list(logA ~ 1 , B ~
2011 May 17
2
can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)
Dear R-users, I am using R 2.13.0 and rms 3.3-0 , but can not reproduce figure 7.8 of the handouts *Regression Modeling Strategies* ( http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf) by the following code. Could any one help me figure out how to solve this? setwd('C:/Rharrell') require(rms) load('data/counties.sav') older <- counties$age6574 + counties$age75
2011 Mar 21
1
round, unique and factor
Survfit had a bug in some prior releases due to the use of both unique(times) and table(times); I fixed it by rounding to 15 digits per the manual page for as.character. Yes, I should ferret out all the usages instead, but this was fast and it cured the user's problem. The bug is back! A data set from a local colleage triggers it. I can send the rda file to anyone who wishes. The
2007 Nov 28
1
Histograms and Sturges rule
Dear All, According to the Sturges rule, the number of classes of a histogram is the closest integer to 1 + logb(n,base=2) where n is the number of observations. The function hist(), by default, uses the Sturges rule. However, the code x <- 1:200 hist(x) produces a histogram with 10 classes and not 9 classes as determined by the Sturges rule. What am I missing? Thanks in advance, Paul
2006 Sep 15
1
Grouping columns in a data frame based on the values of a column
Dear R users, This is a trivial question, there might even be an R function for it, but I have to do it many times and wonder if there is an efficient for it. Suppose we have a data frame like this: d <- data.frame(x=sample(seq(0.1:1, by=0.01), size=100, replace=TRUE), y=rnorm(100, 0.2, 0.6)) and want to have the average of y for a given interval of x, for example mean(y)[0>x>0.1]. Is
2007 Sep 25
7
Who uses R?
Dear R users, I have started work in a Statistics government department and I am trying to convince my bosses to install R on our computers (I can't do proper stats in Excel!!). They asked me to prove that this is a widely used software (and not just another free-source, bug infected toy I found on the web!) by suggesting other big organisations that use it. Are you aware of any reputable
2004 Jul 06
1
vectorizing sapply() code (Modified by Aaron J. Mackey)
[ Not sure why, but the first time I sent this it never seemed to go through; apologies if you're seeing this twice ... ] I have some fully functional code that I'm guessing can be done better/quicker with some savvy R vector tricks; any help to make this run a bit faster would be greatly appreciated; I'm particularly stuck on how to calculate using "row-wise" vectors