Displaying 20 results from an estimated 10000 matches similar to: "creating random numbers"
2007 Apr 26
3
adding a column to a matrix
i would like to add a variable to an existing matrix by manipulating 2 previous variables eg for the data
m
treat strata censti survTime
[1,] 1 2 284.684074 690.4961005
[2,] 1 1 172.764515 32.3990335
[3,] 1 1 2393.195400 24.6145279
[4,] 2 1 30.364771 8.0272267
[5,] 1 1 523.182282 554.7659501
l
2007 May 16
2
creating different strata
hie
l would like to create about ten strata l have tried using
sample(c(1,2),1,replace=TRUE) but all l get is a vector of 1 and 2 if i change it to sample(c(1,10),1,replace=TRUE) it gives me a vector of 1 and 10 how do l go about it
---------------------------------
[[alternative HTML version deleted]]
2007 May 07
4
creating a new column
hie l would like to create a 6th column "actual surv time" from the following data
the condition being
if censoringTime>survivaltime then actual survtime =survival time
else actual survtime =censoring time
the code l used to create the data is
s=2
while(s!=0){ n=20
m<-matrix(nrow=n,ncol=4)
2007 May 17
2
controling the size of vectors in a matrix
hie R users
l have the following matrix
n=20
m<-matrix(nrow=n,ncol=4)
colnames(m)=c("treatmentgrp","strata","survivalTime")
for(i in 1:n) m[i,]<-c(sample(c(1,2),1,replace=TRUE),sample(c(1:2),1,replace=TRUE),rexp(1,0.07),rexp(1,0.02))
2007 May 02
2
missing package
l'm trying to find the "survdiff" package/function but it seems i cant get it how do l instal it if its not there
thanks
---------------------------------
[[alternative HTML version deleted]]
2007 May 17
1
creating columns
l would like to create the following matrice
treatmentgrp strata
1 1 1 1 1 1 1 2 1 2 1 2 2 1 2 1 2 1 2 2 2 2 2 2 l should be able to choose the size of the treatment grps and stratas the method l used intially creates the
2007 Apr 19
1
Random number generator in R compared
I am trying to generate survival data using R .Im trying to randomly generate a column of 1s and 0 and another column randomly generated using an exponential distribution but l cant seem to get the random function. how do l go about it
thanks in advance
rt chiruka
---------------------------------
[[alternative HTML version deleted]]
2007 May 07
2
computing logrank statistic/test
hie how do you compute the logrank test using R
what commands do you use my data looks something like just an example
treatmentgrp strata censoringTime survivalTime censoring act.surv.time
[1,] 2 2 42.89005 1847.3358 1 42.89005
[2,] 1 1 74.40379 440.3467 1 74.40379
[3,] 2 2
2007 Oct 29
3
using survfit
hie
when i use plot.survfit to plot more than one graph why I only see the last graph how do i see the other graphs.for example
n=20
n1=n/2
n2=n/4
a11=4;a12=4 ;a21=4 ;a22=4
t1<-array(1,c(n1))
t2<-array(2,c(n1))
treatgrp=matrix(c(t1,t2))
2007 May 14
1
logrank
hie
is it possible to get the code for the logrank test l just need the chisquared value.
thanks
---------------------------------
[[alternative HTML version deleted]]
2007 Oct 18
1
programming question
hie
i'm tryimg to generate two survival data using the following code (I know its ugly ) but it seems to repeat two of the variables can any one tell me whats the porblem.
n=20
n1=n/2
n2=n/4
a11=1 ;a12=1.4 ;a21=16 ;a22=a12 * a21
t1<-array(1,c(n1))
t2<-array(2,c(n1))
treatgrp=matrix(c(t1,t2))
2007 May 01
7
logrank test
how do l programme the logrank test. l am trying to compare 2 survival curves
---------------------------------
[[alternative HTML version deleted]]
2007 Nov 13
3
cronbach's alpha
hie
1...i'm trying to carryout a relibility testusing cronbach's alpha what fuctin do i use.
2.. this is more of a statistical question.if the alpha value for all the variables is negative what does it mean. and if the alpha value is negative for all tyha variables but is greater than 0.7 for some sections of the variables what does that mean
thanks in advance
2007 Mar 06
2
Generate random numbers up to one
Dear all,
I would like to know if there is a simple way to generate random numbers
with the constrain that they sum up to one. I am new using R...
Thanks in advance,
N?ria
_________________________________________________________________
Acepta el reto MSN Premium: Correos m?s divertidos con fotos y textos
incre?bles en MSN Premium. Desc?rgalo y pru?balo 2 meses gratis.
2012 Jan 27
3
generate a random number with rexp ?
dear list
I use runif to generate a ramdom number between min and max
runif(n, min=0, max=1)
however , the syntaxe of rexp does not allow that
rexp(n, rate = 1)
and it generate a number with the corresponding rate.
The question is: how to generate a number between min and max using rexp().
Regards
--
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
2007 Oct 19
6
r achives
sorry but how do i accsess r archives
__________________________________________________
[[alternative HTML version deleted]]
2006 Aug 15
1
rexp question
I am using rexp to generate several exponential distributions. I am passing
rexp a vector of rates , r. I am wanting to simulate a sample of size 200
for each rate so the code looks like: rexp(n=200*length(r),rate=r) this
gives me a vector of the random exponential variables, but they are all
disjointed b/c rexp goes through and simulates an exponential variable for
each rate and it does that 200
2006 Feb 03
2
Problems with ks.test
Hi everybody,
while performing ks.test for a standard exponential distribution on samples
of dimension 2500, generated everytime as new, i had this strange behaviour:
>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)
One-sample Kolmogorov-Smirnov test
data: data
D = 0.0147, p-value = 0.6549
alternative hypothesis: two.sided
>data<-rexp(2500,0.4)
2002 May 03
6
problems with rexp ?
Does anyone know if R have any problems with the exponential random number
generation (function rexp)?
I comment it because I executed
data<-sort(rexp(100))
plot(data,dexp(data)/(1-pexp(data)),type="l")
and the graphic isn't constant.
(Note: exponential distribution have a constant hazard failure rate).
Thank you,
Juan
2011 Nov 16
2
Error in random walk Metroplis-hasting
Hi R community,
I have some data set and construct the likelihood as follows
likelihood <- function(alpha,beta){
lh<-1
d<-0
p<-0
k<-NULL
data<-read.table("epidemic.txt",header = TRUE)
attach(data, warn.conflicts = F)
k <-which(inftime==1)
d <- (sqrt((x-x[k])^2+(y-y[k])^2))^(-beta)
p<-1 - exp(-alpha*d)
for(i in 1:100){