Skip to content

Fit data to distribution

1 message · Muhammad Rahiz

#
Hi all,

I hope to get some assistance in this. I have two datasets, x and y. I'm 
trying to fit dataset y to the distribution of dataset x. I have the 
shape, and rate of the distribution of dataset x, but not it's scale.

x  <- abs(rnorm(21))
y  <- abs(rnorm(21))

plot(density(x))
lines(density(y),col="red")
legend("topright",legend=c("x","y"),col=c("black","red"),lty=1,bty="n")

x1 <- fitdistr(x,"gamma")$estimate 	# get scale and rate