[R] questions about optim

Spencer Graves spencer.graves at pdf.com
Sat May 15 23:59:32 CEST 2004


      I gather you are trying to solve a system of 5 equations with 7 
unknowns:  The 5 equations are the constraint that the probabilities sum 
to 0 plus the 4 equations I wrote?  This is an underdetermined system, 
and you should not need "optim" for that. 

      Why do you want a multinomial approximation to a normal with the 
breakpoints unknown?  What's the problem for which an answer to your 
question should provide a solution? 

      hope this helps.  spencer graves

Dean Lee wrote:

> Hi Spencer,
> Thanks for the reply.
>
> 1) When I was playing with optim before sometimes the probabilities 
> came up to be negative. I am not sure what I did before, but now it 
> seems to work correctly after I specify the lower and upper bounds on 
> the Thetas using the L-BFGS-B method in optim.
>
> 2) No the break points are not given. But yes, I am trying to estimate 
> a multinomial to a normal; sorry I wasn't being clear. What are some 
> of the approaches that I can try in this case? Thanks.
>
> Regards,
>
> -Dean
>
>
>
>
>
>> From: Spencer Graves <spencer.graves at pdf.com>
>> To: Dean Lee <deanylee at hotmail.com>
>> CC: r-help at stat.math.ethz.ch
>> Subject: Re: [R] questions about optim
>> Date: Sat, 15 May 2004 13:38:38 -0700
>>
>>      1.  Have you considered parameterizing the problem in terms of 
>> (Theta1, Theta2, Theta3), and then computing Theta4 <- 
>> (1-Theta1-Theta2-Theta3) in the function you ask "optim" to optimize?
>>
>>      2.  Beyond this, I don't understand what you are trying to do.  
>> Do you want to estimate a multinomial approximation to a normal 
>> distribution?  If yes, are you given the mean and standard deviation 
>> of the normal distribution PLUS the break points?  If yes, then what 
>> about the following:
>>
>> > Breaks <- 1:3
>> > Mean <- 0
>> > Sd <- 1
>> > Theta1 <- pnorm((Breaks[1]-Mean)/Sd)
>> > Theta2 <- (pnorm((Breaks[2]-Mean)/Sd)-Theta1)
>> > Theta3 <- (pnorm((Breaks[3]-Mean)/Sd)-Theta2)
>> > Theta4 <- pnorm((Breaks[3]-Mean)/Sd, lower.tail=FALSE)
>> > Breaks <- 1:3
>> > Mean <- 0
>> > Sd <- 1
>> > Theta1 <- pnorm((Breaks[1]-Mean)/Sd)
>> > Theta2 <- (pnorm((Breaks[2]-Mean)/Sd)-Theta1)
>> > Theta3 <- (pnorm((Breaks[3]-Mean)/Sd)-Theta2)
>> > Theta4 <- pnorm((Breaks[3]-Mean)/Sd, lower.tail=FALSE)
>> > Theta1;Theta2;Theta3;Theta4
>> [1] 0.8413447
>> [1] 0.1359051
>> [1] 0.862745
>> [1] 0.001349898
>>
>>       hope this helps.  spencer graves
>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>




More information about the R-help mailing list