Displaying 20 results from an estimated 177 matches for "1,100".
Did you mean:
1,102
2013 Aug 27
1
R Language Newbie
Hi,
set.seed(29)
myVector<- rnorm(100)
?seq(1,100,by=2)
# [1]? 1? 3? 5? 7? 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
#[26] 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
myVector[seq(1,100,by=2)]
rev(myVector)
?sum(myVector>0)
#[1] 46
#or
?table(myVector>0)
#
#FALSE? TRUE
?...
2004 Mar 05
1
Application of step to coxph using method="exact" (PR#6646)
Full_Name: John E. Kolassa
Version: Version 1.8.1
OS: Solaris
Submission from: (NULL) (128.6.76.36)
Stepwise model selection for coxph appears to fail with method="exact".
The code
step(coxph(Surv(1:100,rep(1,100))~factor(rep(1:4,25)),method="exact"))
produces the error message
Start: AIC= 733.07
Surv(1:100, rep(1,...
2010 Sep 23
1
scatterplot 3d equal axis sequence length limitation
I was wondering if anyone has a way out of the limitation that you must use
equal length
x,y, and z sequence lengths.
For instance,
x<-seq(1,100)
y<-seq(1,100)
z<-rnorm(100)
scatterplot3d(z,x,y)
works fine.
However, if I get some results that has a different y subset length, such as
x<-seq(1,100)
y<-seq(1,300)
z<-rnorm(100)
scatterplot3d(z,x,y)
I get the following error:
Error in xyz.coords(x = x, y = y, z = z, xlab =...
2009 Feb 27
3
question about 3-d plot
Hi R Users,
I have produced a simulated scatter plot of y versus x tightly clustered
around the 45 degree line through the origin with the following code:
x <- seq(1,100)
y <- x+rnorm(100,0,10)
plot(x,y,col="blue")
abline(0,1)
Is there some way to generate a 3-dimensional analogue of this? Can I get a
similar simulated scatter plot of points in 3 dimensions where the points
are clustered around a plane through the origin where the plane in ques...
2011 Jun 28
2
problem with corrgram function
Dear list,
I have a problem with the "corrgram" function. It does not seem to
"color" large negative correlations, while the same correlation, if
positive, provides no problems. Is this a bug?
require(corrgram)
a = seq(1,100)
b = -jitter(seq(1,100), 80)
cor(a,b) # r about -.96
c=as.data.frame(cbind(a,b))
corrgram(c, order=NULL, lower.panel=panel.pie,upper.panel=NULL,
text.panel=panel.txt) # no color
c$b = -1*c$b # flip direction of correlation
cor(c$a, c$b) # r now about +.96
corrgram(c, order=NULL, lower...
2008 Jun 21
1
Coloring Stripchart Points, or Better, Lattice Equivalent
...doing this with Lattice, but I?ve tried
several variations of stripplot and can?t even get something with the
general layout of the stripchart version.
Thanks, Bryan
*************
Bryan Hanson
Professor of Chemistry & Biochemistry
DePauw University, Greencastle IN USA
index <- round(runif(100, 1, 100))
resp <- rbinom(100, 1, 0.5)
yr <- rep(c("2005", "2006"), 50)
all <- data.frame(index, resp, yr)
for (n in 1:length(all$index)) {
if (all$yr[n] == 2005) {all$col[n] <- "red"}
else {all$col[n] <- "blue"}
}
for (n in 1:leng...
2001 Nov 27
3
Table Command (PR#1182)
Full_Name: Manisha Desai
Version: 1.3.0
OS: UNIX
Submission from: (NULL) (156.111.36.213)
There may be a bug in the table command.
The value of 0 does not appear to show up (at least in this version of R).
The following is an example:
> blah<-c(rep(1,100),rep(0,100))
> table(blah)
Gives the following:
blah
1
100...
2007 Dec 10
5
Neat conditional assignment
I would like to make a new vector with values taken from two existing
vectors conditional upon a third. At present I am doing this with a for loop
but wonder if there is not a neater way, given some of the very neat things
R can do.
a<-rep(c("A","B"),50)
b<-rep(1,100)
c<-rep(2,100)
a is thus "A" "B" "A" "B" "A" "B"...
b is thus 1 1 1 1 1 1 ...
c is thus 2 2 2 2 2 2 ...
I want d[i] to be b[i] if a[i]=="A" and c[i] if a[i]=="B". I'm current using
a for loop:
d<-rep(0,...
2007 Jan 03
1
problem with logLik and offsets
Hi,
I'm trying to compare models, one of which has all parameters fixed
using offsets. The log-likelihoods seem reasonble in all cases except
the model in which there are no free parameters (model3 in the toy
example below). Any help would be appreciated.
Cheers,
Jarrod
x<-rnorm(100)
y<-rnorm(100, 1+x)
model1<-lm(y~x)
logLik(model1)
sum(dnorm(y, predict(model1), summary(model1)$sigma,log=TRUE))
# no offset - in agreement
model2<-lm(y~offset(rep(1,100))+x-1)
logLik(model2)
sum(dnorm(y, predict(model2),summary(model2)$sigma,log=TRUE))
# offset and free parameters...
2011 Oct 04
0
matrix of chi-square results for all combinations of data frame
...nd then use that
in a loop to get the p-values with chisq.test() . It works if I specify the
combination by hand but not in the loop. What am I doing wrong? (
I would appreciate any advice. Sample code below.
Thanks in advance
Christiaan
# Sample Code
# create test data
df=data.frame(x=sample(0:1,100,replace=TRUE),x.1=sample(0:1,100,replace=TRUE),
x.2=sample(0:1,100,replace=TRUE), x.3=sample(0:1,100,replace=TRUE))
# make a data frame of all possible combinations
grd=expand.grid(colnames(df),colnames(df))
# make vector of p values
pval <- for (i in 1: length(grd[,1])){
chisq.test(df...
2011 Jul 15
1
Plotting survival curves from a Cox model with time dependent covariates
Dear all,
Let's assume I have a clinical trial with two treatments and a time to
event outcome. I am trying to fit a Cox model with a time dependent
treatment effect and then plot the predicted survival curve for one
treatment (or both).
library(survival)
test <-
list(time=runif(100,0,10),event=sample(0:1,100,replace=T),trmt=sample(0:1,100,replace=T))
model1 <- coxph(Surv(time, event) ~ tt(trmt), data=test, tt=function(x,
t, ...) pspline(x + t))
newdat1 <- data.frame(trmt=1,time=list(0,1,2,3,4,5))
plot(survfit(model1,newdata=newdat1,individual=T), xlab = "Years&q...
2010 Nov 16
0
LATTICE. On skip, index.cond with a formula like Y~X|A+B
Dear invaluable R-list,
my present problem is arranging/removing some panels in a lattice plot.
Please consider the following:
df.data <-
cbind.data.frame(expand.grid(SUBJ=1:5,
TREAT=LETTERS[1:4],
REF=letters[1:4]
)
)
df.data <-
df.data[order(df.data$TREAT,df.data$REF), ]
df.data <-
cbind.data.frame(df.data[,2:3],...
2009 Nov 02
5
Optimizar código
Hola lista, tengo una base de datos muy grande de un datalogger.
Consiste en un vector con 0's y 1's, y tengo que ver cuando hay 600 o
más unos seguidos. Se me ocurrió hacerlo con un loop for. Pero tarda
demasiado. También intente usar which para que seleccione solo los 1
para empezar a sumar pero no hay gran diferencia. A alguien se le
ocurre alguna solución para hacerlo más rápido?
Acá es...
2001 Feb 05
1
clipped lines have wrong slope in log plot (PR#839)
Hi,
I'm using R version 1.2.0 (2000-12-15), on RedHat Linux 6.2 (kernel 2.2.14).
The following command ought to plot a straight-line on a log-log
graph but instead plots two line segments, both with the wrong
slope:
plot(c(1,10,100),c(100,10,1),type="l",xlim=c(1,20),ylim=c(1,20),log="xy")
Only clipp...
2002 Mar 20
5
inverted axis
Hello everybody!
Spse I have the following
X <- seq(1:100) #(a dim(100) sequence of integers 1:100 representing
the possible actions of player 1 and player2 in a game)
BR2X<- br2(X) #(a dim(100) sequence of points on range (1,100)
representing the best response function of player 2 to player 1:s
actions)
BR1X<- br1(X) #(a dim(100)...
2012 May 31
3
Remove columns from dataframe based on their statistics
Hi,
I have a dataframe and want to remove columns from it
that are populated with a similar value (for the total
column) (the variation of that column is 0). Is there an
easier way than to calculate the statistics and then
remove them by hand?
A <- runif(100)
B <- rep(1,100)
C <- rep(2.42,100)
D <- runif(100)
df <- data.frame(A,B,C,D) # if want to conditionally remove column B and C as they show no variations
/Johannes
--
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
2006 Aug 02
2
lme4 and lmeSplines
I'm trying to use the lmeSplines package together with lme4.
Below is (1) an example of lmeSplines together with nlme (2) an
attempt to use lmeSplines with lme4 (3) then a comparison of the
random effects from the two different methods.
(1)
require(lmeSplines)
data(smSplineEx1)
dat <- smSplineEx1
dat.lo <- loess(y~time, data=dat)
plot(dat.lo)
dat$all <- rep(1...
2003 Aug 19
9
Variance Computing- - HELP!!!!!!!!!!!!!!!!!!
...I am running a few simulations for clinical trial anlysis. I want some help
regarding the following.
We know trhat as the sample size increases, the variance should decrease, but
I am getting some unexpected results. SO I ran a code (shown below) to check
the validity of this.
large<-array(1,c(1000,1000))
small<-array(1,c(100,1000))
for(i in 1:1000){large[i,]<-rnorm(1000,0,3)}
for(i in 1:1000){small[i,]<-rnorm(100,0,3)}}
yy<-array(1,100)
for(i in 1:100){yy[i]<-var(small[i,])}
y1y<-array(1,1000)
for(i in 1:1000){y1y[i]<-var(large[i,])}
mean(yy);mean(y1y);
[1] 8.944...
2006 Dec 04
7
I need help to connect Postgres and Ruby on Rails Please.
...nd
trying to do a project in Ruby on Rails and I need to connect with a
Data Base that is en Postgres, the truth is that I didn’t think that it
was so hard to connect a DB with postgres because I was working with
Msyql and everything was easy. This are the thinks that I have install
in my computer.
1. Debian GNU/Linux, kernel 2.4.27-2-686.
2. Ruby 1.8.2
3. Postgresql 7.4.7-6 sarge1
4. Gems: actionmailer-1.2.5, actionpack-1.12.5, actionwebservice-1.1.6,
activerecord-1.14.4, activesupport-1.3.1, postgres-pr-0.2.1,
rails-1.1.6, rake-0.7.1
5. ruby-postgres-0.7.1.tar.tar
The error is that after...
2008 Jun 26
1
Gettting barchart titles as numbers not characters
Hi, I wonder if you could help me with my barcharts, I am using the
barchart function from the lattice library.
I have data like this:
Complex,Organisms,Percentage
130,0,50
130,1,10
130,2,20
130,3,15
130,4,5
133,0,10
133,1,15
133,2,20
133,3,50
133,4,5
I draw barcharts using this command...
barchart(Percentage~Organisms|Complex,data=data,layout=c(1,2),col=rainbow(5),box.ratio=3,horizontal=FALSE,xlim=c(" 0 "," 1 "," 2 "," 3 &qu...