[R] incorrect number of subscripts on matrix

2012-06-29 Thread andre bedon
Hi, Wondering if anyone could help me out with this error.Im trying to fill a matrix with random numbers taken from an exponential distribution using a loop: x.3-matrix(rep(0,3000),nrow=1000,byrow=T)for(i in 1:1000){x[i,]-rexp(3,rate=2/3)} I get the error message: Error in x[i, ] - rexp(3, rate

[R] FW: Regression coefficient constraints

2011-09-04 Thread andre bedon
From: andresa...@hotmail.com To: r-help@r-project.org Subject: Regression coefficient constraints Date: Sun, 4 Sep 2011 15:50:09 +1000 Hi Guys, Does anyone know how I could constrain my regression coefficients so that they are positive and add up to one? Any help will be greatly

[R] Regression coefficient constraints

2011-09-03 Thread andre bedon
Hi Guys, Does anyone know how I could constrain my regression coefficients so that they are positive and add up to one? Any help will be greatly appreciated. Kind Regards, Andre [[alternative HTML version deleted]]

[R] Survreg object

2011-05-14 Thread andre bedon
Hi,Just a quick one, does anyone know the command for accessing the standard errors from a survreg object? I can access the coefficients by model$coefficients, but I cant seem to find a command to access the errors. Any help would be greatly appreciated.Regards,Andre

[R] for loop

2011-05-06 Thread andre bedon
Hi, I'm hoping someone can offer some advice:I have a matrix x of dimensions 160 by 1. I need to create a matrix y, where the first 7 elements are equal to x[1]^1/7, then the next 6 equal to x[2]^1/6, next seven x[3]^1/7 and so on all the way to the 1040th element. I have implemented

[R] vector decreasing by a factor

2011-05-02 Thread andre bedon
Hi, I'm quite new to R so this question will sound quite fundamental. I need to create a vector of length 160. The first element should be (1+r)^159 and each element thereafter should decrease by a factor of (1+r) until the 160th element that should be 1. Is there a function similar to seq()

[R] acf function

2010-09-26 Thread andre bedon
Hi, Im new to R so this question is quite fundamental. Im trying to compare some autocorrelations generated by the acf function to some theoretical correlations. How can I have acces to just the autocorrelations, for computation? This is some of my code: acf.data-c(acf(x)) acf.data

[R] for loop

2010-09-21 Thread andre bedon
Hi guys, Im new to R and am having a bit of trouble with what should be a simple loop. It sprobably something very fundamental that im doing wrong. for(i in c(1:520)) { tmp1- ((1-samp.pct[i])^2)*(log(1-theor.pct[i])-log(1-theor.pct[i+1])) tmp2-

[R] survfit question

2010-09-09 Thread andre bedon
Hi, I am attempting to graph a Kaplan Meier estimate for some claims using the survfit function. However, I was wondering if it is possible to plot a cdf of the kaplan meier rather than the survival function. Here is some of my code: library(survival) Surv(claimj,censorj==0)