Re: [R] About truncated distribution
I resend this to expect more responses. Thanks! Inspired by the responses, I tried to do this analytically. The idea is that truncated mean and standard deviation could be expressed as integral forms. So if given truncated mean, sd and truncated point (mut, sdt, thre), an optim( ) function could be writen to get the parameters. But the problem is, pdf is needed in advance to shape the normal curve. So I think it is possible to do this in an iterative optimization, given assummed initial sigma and mu, if the optimization meets requirements, then the sigma and mu could be considered as the real numbers. I tried to do these by : f - function(x,sigma,mu) (1/(sigma*sqrt(2*pi)))*exp(-(x-mu)^2/(2*sigma^2)) pdf.fun - function(x) x*f(x); sd.fun - function(x) x^2*f(x); #-- define a few functions solve.fun - function(sigma,mu,thre,mut,sdt) { (mut-integrate(pdf.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value)^2 +(sdt - integrate(sd.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value-(integrate(pdf.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value)^2)^2 } I wish this solve.fun ( ) could be minimized and then gives minimum = 5 for( i in 1:100) { mu - 200;sigma - 20; thre - 160; mut - 230; sdt - 15; sol.tem - optimize(solve.fun, lower =0.1,upper =100,tol=0.001); if (sol.tem$minimum = 5) return(sol.tem) } I know my codes is just awkward, and not really working. But I expect some advice and suggestion about the methods. Am I going in a wrong way since I have been working on it for a long time. Thanks a lot! Jen -Original Message- From:Ritwik Sinha , [EMAIL PROTECTED] Sent: 2006-09-12, 17:20:04 To: CC:jennystadt; r-help@stat.math.ethz.ch Subject: Re: [R] About truncated distribution However, if you know the point(s) of truncation then you should be able to work your way back. Look for the mean and variance of a truncated normal, it will involve mu, sigma and c (point of truncation). You will need to solve for mu and sigma from two equation. For example look at the wikipedia page on normal distribution, it has the mean of a truncated normal distribution. Many standard statistics books should have the rest of the information. On 9/12/06, Berton Gunter [EMAIL PROTECTED] wrote: But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? You can't, as they are plainly not sufficient (you need to know the amount of truncation also). If you have only the mean and sd and neither the actual data nor the truncation point you're through. -- Bert Gunter Genentech Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About truncated distribution
Inspired by the responses, I tried to do this analytically. The idea is that truncated mean and standard deviation could be expressed as integral forms. So if given truncated mean, sd and truncated point (mut, sdt, thre), an optim( ) function could be writen to get the parameters. But the problem is, pdf is needed in advance to shape the normal curve. So I think it is possible to do this in an iterative optimization, given assummed initial sigma and mu, if the optimization meets requirements, then the sigma and mu could be considered as the real numbers. I tried to do these by : f - function(x,sigma,mu) (1/(sigma*sqrt(2*pi)))*exp(-(x-mu)^2/(2*sigma^2)) pdf.fun - function(x) x*f(x); sd.fun - function(x) x^2*f(x); #-- define a few functions solve.fun - function(sigma,mu,thre,mut,sdt) { (mut-integrate(pdf.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value)^2 +(sdt - integrate(sd.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value-(integrate(pdf.fun,thre,upper=Inf)$value/integrate(f,thre,upper=Inf)$value)^2)^2 } I wish this solve.fun ( ) could be minimized and then gives minimum = 5 for( i in 1:100) { mu - 200;sigma - 20; thre - 160; mut - 230; sdt - 15; sol.tem - optimize(solve.fun, lower =0.1,upper =100,tol=0.001); if (sol.tem$minimum= 5) return(sol.tem) } I know my codes is just awkward, and not really working. But I expect some advice and suggestion about the methods. Am I going in a wrong way since I have been working on it for a long time. Thanks a lot! Jen -Original Message- From:Ritwik Sinha , [EMAIL PROTECTED] Sent: 2006-09-12, 17:20:04 To: CC:jennystadt; r-help@stat.math.ethz.ch Subject: Re: [R] About truncated distribution However, if you know the point(s) of truncation then you should be able to work your way back. Look for the mean and variance of a truncated normal, it will involve mu, sigma and c (point of truncation). You will need to solve for mu and sigma from two equation. For example look at the wikipedia page on normal distribution, it has the mean of a truncated normal distribution. Many standard statistics books should have the rest of the information. On 9/12/06, Berton Gunter [EMAIL PROTECTED] wrote: But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? You can't, as they are plainly not sufficient (you need to know the amount of truncation also). If you have only the mean and sd and neither the actual data nor the truncation point you're through. -- Bert Gunter Genentech Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] About truncated distribution
Hi All, I tried RSiteSearch('truncated distribution') , and found a lot of threads on 'fitting truncated normal distribution'. No doubt they are all helpful in fitting the distribution based on the data of known original mean and sd. But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] About truncated distribution
Dear listers, I tried RSiteSearch('truncated distribution') , and found a lot of threads on 'fitting truncated normal distribution'. No doubt they are all helpful in fitting the distribution based on the data of known original mean and sd. But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About truncated distribution
But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? You can't, as they are plainly not sufficient (you need to know the amount of truncation also). If you have only the mean and sd and neither the actual data nor the truncation point you're through. -- Bert Gunter Genentech Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About truncated distribution
However, if you know the point(s) of truncation then you should be able to work your way back. Look for the mean and variance of a truncated normal, it will involve mu, sigma and c (point of truncation). You will need to solve for mu and sigma from two equation. For example look at the wikipedia page on normal distribution, it has the mean of a truncated normal distribution. Many standard statistics books should have the rest of the information. On 9/12/06, Berton Gunter [EMAIL PROTECTED] wrote: But my question is a bit different. What I know is the mean and sd after truncation. If I assume the distribution is normal, how I am gonna develope the original distribution using this two parameters? You can't, as they are plainly not sufficient (you need to know the amount of truncation also). If you have only the mean and sd and neither the actual data nor the truncation point you're through. -- Bert Gunter Genentech Could anybody give me some advice? Thanks in advance! Jen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.