Displaying 1 result from an estimated 1 matches for "npnt".
Did you mean:
dpnt
2001 Aug 28
2
fitting a mixture of distributions with optim and max log likelihood ?
hi
Suppose I have a mixture of 2 distributions generated by
rtwonormals <- function(npnt,m1,s1,m2,s2,p2){
rv<-vector(npnt,mode="numeric")
for( i in seq(1:npnt)){
if(runif(1,0,1)<=p2){
rv[i]<-rnorm(1,m2,s2)
}
else{
rv[i]<-rnorm(1,m1,s1)
}
}
return(rv)
}
x <- rtwonormals(50000,0,100,500,500,0.05)
#and I try to fit these with (based on thread...