Displaying 4 results from an estimated 4 matches for "meantrue".
2012 Apr 11
1
R-help; Censoring
Hello,
I wish to?censor 10% of my sample units of 50 from a Weibull distribution. Below is the code for it.
I will need to know whether what i have done is correct and if not, can i have any suggestion to improve it?
Thank you
?p=2;b=120
n=50
r=45
t<-rweibull(r,shape=p,scale=b)
meantrue<-gamma(1+(1/p))*b
meantrue
cen<- runif(n-r,min=0,max=meantrue)
cen
Chris Guure
Researcher,
Institute for Mathematical Research
UPM
2012 Apr 16
1
R: Help; error in optim
...ch states that
Error in optim(start, fn = z, data = q, hessian = T) :?
? objective function in optim evaluates to length 25 not 1
can somebody?help me remove this error. Is my censoring approach correct.
n=25;rr=1000
p=1.5;b=1.2
for (i in 1:rr){
q<-c(t,cen)
t<-rweibull(25,shape=p,scale=b)
meantrue<-gamma(1+(1/p))*b
meantrue
d<-meantrue/0.30
cen<- runif(25,min=0,max=d)
cen
s<-ifelse(t<=cen,1,0)
z<-function(data,p){?
beta<-p[1]
eta<-p[2]
log1<-(n*cen*log(p[1])-n*cen*(p[1])*log(p[2])+cen*(p[1]-1)*sum(log(t))-n*sum((t/(p[2]))^(p[1])))
return(-log1)
}
start <-c(0.5,...
2012 Sep 20
3
Problem with Newton_Raphson
...he code is given below; The problem is that, the newton-Raphson approach isnt working and i do not know what is wrong.?Can somebody suggest something or help in identifying what the problem might be.?
p1<-0.6;b<-2
n=20;rr=5000
U<-runif(n,0,1)
for (i in 1:rr){
x<-(-log(1-U^(1/p1))/b)
?meantrue<-gamma(1+(1/p1))*b
? meantrue
? d<-meantrue/0.30
? cen<- runif(n,min=0,max=d)
? s<-ifelse(x<=cen,1,0)
? q<-c(x,cen)
? ? z<-function(data, p){?
? ? shape<-p[1]
? ? scale<-p[2]
? ? log1<-n*sum(s)*log(p[1])+ n*sum(s)*log(p[2])+(p[1]-1)*sum(s)*log(1-((exp(-(p[2])*sum(x)))...
2012 Apr 14
0
R-help: Censoring data (actually an optim issue
...ion to obtain the desire estimate is where i have a problem with,
> ?can some body help?
> ?My likelihood equation is for a random type-I censoring where time for the censored units is different for each unit.
> ?
> n=50;r=35
> p=0.8;b=1.5
> t<-rweibull(50,shape=p,scale=b)
> meantrue<-gamma(1+(1/p))*b
> meantrue
> d<-meantrue/0.30
>
> cen<- runif(50,min=0,max=d)
> cen
> s<-ifelse(t<=cen,1,0)
> s
>
> z<-function(p){?
> shape<-p[1]
> scale<-p[2]
> log1<-(r*log(p[1])-r*(p[1])*log(p[2])+(p[1]-1)*sum(log(t))-sum((t/(p[...