similar to: code for "permutative" operation

Displaying 20 results from an estimated 500 matches similar to: "code for "permutative" operation"

2011 Mar 01
0
unicode&pdf font problem RESOLVED
Just to add to this (I've been looking through the archive) problem with display unicode fonts in pdf document in R If you can use the Cairo package to create pdf on Mac, it seems quite happy with pushing unicode characters through (probably still font family dependant whether it will display) probstring <- c(' \u2264 0.2',' \u2268 0.4',' \u00FC 0.6',' \u2264
2011 Mar 04
3
S. function calculating x +- y
Hello, I am looking for an elegant one-liner for the following operation: x <- rnorm(10) y <- runif(10) c(mean(x)-mean(y), mean(x)+mean(y)) I thought about apply(data.frame(x, y), 2, mean) but I don't know how to apply the +- operation on the result of apply. Thanks, *S* -- Sascha Vieweg, saschaview at gmail.com
2012 Aug 15
2
sample() from (un-)sorted vectors
Hello, Vector y is an alphabetically sorted version of vector x. Will both samples, X and Y, be "absolutely" random or will they have systematic differences? And: Should I sort or shuffle a vector before sampling? Thank you, *S* x <- as.factor(LETTERS[sequence(10:1)]) y <- sort(x) X <- sample(x, 5) Y <- sample(y, 5) -- Sascha Vieweg, saschaview at gmail.com
2011 Jan 20
1
predict() for bootstrapped model coefficients
I run a multinomial regression on a data set with an outcome that has three values. First, I build an initial model, b.mod. Then I run a loop to bootstrap the coefficients. For the initial model, using "predict()", I can print the wrong/false predictions table. But how do I get this table (that is, the predictions) for the bootstrapped model? Thanks for hints, *S* df <-
2011 Apr 08
1
multinom() residual deviance
Running a binary logit model on the data df <- data.frame(y=sample(letters[1:3], 100, repl=T), x=rnorm(100)) reveals some residual deviance: summary(glm(y ~ ., data=df, family=binomial("logit"))) However, running a multinomial model on that data (multinom, nnet) reveals a residual deviance: summary(multinom(y ~ ., data=df)) On page 203, the MASS book says that "here the
2011 Jan 31
1
Sweave: change tab size
When Sweave outputs function code that spreads across many lines, the default indent of inner lines is 4 spaces (plus the prompt). How can I change that default to 2 spaces? I tried to adjust my Sweave.sty with the option tabsize but that doesn't show an effect. Also the Sweave documentation did not provide a cue. Thanks for hints, *S* -- Sascha Vieweg, saschaview at gmail.com
2011 Apr 20
1
S: expert mailing list for general statistical questions
Hello R users and experts Once in a while I have got questions that are not so much R-related but related to (social scientific) statistics in general. R-help would be the wrong list for such posts, and I am looking for a similar mailing list or newsgroup (nntp). (It is just a personal taste that I don't like web forums.) I have googled and found a variety here:
2011 Nov 29
1
md.pattern ('mice') failure with more than 31 variables
Hello How come that the function md.pattern() from package 'mice' delivers a warning when run over data sets with more than 31 variables? library( 'mice' ) x <- as.data.frame( matrix( sample( c(1:3, 1:3, 1:3, NA), 7000, repl=TRUE ), ncol=35, dimnames=list(NULL, paste('V', 11:45, sep="") ) ) ) md.pattern(x) # Warning message:
2011 Dec 01
1
transform data.frame holding answers --> data.frame holding logicals
Hello Hello I have a data frame, x, holding 5 persons answering the question which cars they have used: # the data frame x <- as.data.frame( matrix( c('BMW', '', '', 'Mercedes', 'VW', '', 'Skoda', 'VW', 'BMW', '', '', '', 'VW', 'Skoda',
2011 Apr 20
2
Include C++ DLL, error in ...: C symbol name not in load table
Hello R experts I am googling and reading around, however, I can't get it working (perhaps because I do not understand much C, however, I'll give it a try). I am trying to include C++ code into an R routine, where the C++ code looks: #include <iostream> using namespace std; void foo (double* x, double* y, double* out) { out[0] = x[0] + y[0]; } Back in R, the command R CMD
2011 Feb 06
1
boot() versus loop, and statistics option
Hello R users I am quite new to bootstrapping. Now, having some data x, ---- R: set.seed(1234) R: x <- runif(300) ---- I want to bootstrap simple statistics, mean and quantiles (.025, .975). Currently, I run a loop ---- R: res <- as.data.frame(matrix(ncol = 3, dimnames = list(NULL, ... c("M", "Lo", "Hi")))) R: for (i in 1:100) { ... y <-
2011 Mar 08
2
plotCI() with ggplot2
Hello Currently, I plot some coefficients with some intervals using function "plotCI()" (package "gplots") using the following code: (m1 <- matrix(0:5, nrow=2, byrow=T, dimnames=list(c("v1", "v2"), c("lo", "m", "hi")))) m2 <- m1 + 1 library(gplots) plotCI( x=1:length(m1[, 1]), pch="",
2011 Jan 28
6
R-/Text-editor for Windows?
Tinn-R (http://www.sciviews.org/Tinn-R/) is one of the topmost suggestions when googling an R-(text-)editor for Windows. However, to me it appears dissappointing that Tinn-R does not handle utf-8 (mac-roman, or any other) encoded R-scripts or, in general, text files. Besides Emacs and the R built-in editor, could you recommend a good editor for Windows, even some commmercial for a small
2011 Nov 18
3
Apply functions along "layers" of a data matrix
Hello How can I apply functions along "layers" of a data matrix? Example: daf <- data.frame( 'id' = rep(1:5, 3), matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )), rep = rep(1:3, each=5) ) The data frame "daf" contains 3 repetitions/layers (rep) of 4 variables of 5 persons (id). For some reason, I want to calculate
2010 Jul 07
2
Sum vectors and numbers
We want to sum many vectors and numbers together as a vector if there is at least one vector in the arguments. For example, 1 + c(2,3) = c(3,4). Since we are not sure arguments to sum, we are using sum function: sum(v1,v2,...,n1,n2,..). The problem is that sum returns the sum of all the values present in its arguments: sum(1,c(2,3))=6 sum(1,2,3)=6 We do not want to turn sum(v1,v2,...,n1,n2,..) to
2012 Feb 19
3
Non-parametric test for repeated measures and post-hoc single comparisons in R?
Some attribute x from 17 individuals was recorded repeatedly on 6 time points using a Likert scale with 7 distractors. Which statistical test(s) can I apply to check whether the changes along the 6 time points were significant? set.seed( 123 ) x <- matrix( sample( 1:7, 17*6, repl=T ), nrow = 17, byrow = TRUE, dimnames = list(1:17, paste( 'T', 1:6, sep='' )) ) I found
2010 Sep 22
2
defining set of variables in a formula
Dear fellow R users, I am trying to conduct a regression analysis. I have thousands of variables. The names are V1, V2,........V2000 Is there an easy way to include these variables in the regression? my model is something like that: model<- lm(y~V1+V2+.....+V2000, data=data) Thanks so much in advance, Ozlem
2013 May 01
3
Adding Column to Data Frames Using a Loop
Dear R Helpers, I am trying to do calculations on multiple data frames and do not want to create a list of them to go through each one. I know that lists have many wonderful advantages, but I believe the better thing is to work df by df for my particular situation. For background, I have already received some wonderful help on how to handle some situations, such as removing columns:
2011 Jun 16
1
prediction intervals
Dear members, I'm fitting linear model using "lm" which has numerous auto-regressive terms as well as other explanatory variables. In order to calculate prediction intervals, i've used a for-loop as the auto-regressive parameters need to be updated each time so that a new forecast and corresponding prediction interval can be calculated. I'm fitting a number of these models
2012 Jun 04
1
simulation of modified bartlett's test
Hi, I run this code to get the power of the test for modified bartlett's test..but I'm not really sure that my coding is right.. #normal distribution unequal variance asim<-5000 pv<-rep(NA,asim) for(i in 1:asim) {print(i) set.seed(i) n1<-20 n2<-20 n3<-20 mu<-0 sd1<-sqrt(25) sd2<-sqrt(50) sd3<-sqrt(100) g1<-rnorm(n1,mu,sd1) g2<-rnorm(n2,mu,sd2)