similar to: Probit and optim in R

Displaying 20 results from an estimated 2000 matches similar to: "Probit and optim in R"

2007 Apr 18
3
Problems in programming a simple likelihood
As part of carrying out a complicated maximum likelihood estimation, I am trying to learn to program likelihoods in R. I started with a simple probit model but am unable to get the code to work. Any help or suggestions are most welcome. I give my code below: ************************************ mlogl <- function(mu, y, X) { n <- nrow(X) zeta <- X%*%mu llik <- 0 for (i in 1:n) { if
2011 Jun 14
1
Using MLE Method to Estimate Regression Coefficients
Good Afternoon, I am relatively new to R and have been trying to figure out how to estimate regression coefficients using the MLE method. Some background: I am trying to examine scenarios in which certain estimators might be preferred to others, starting with MLE. I understand that MLE will (should) produce the same results as Ordinary Least Squares if the assumption of normality holds. That
2011 Jul 04
3
loop in optim
Hi May you help me correct my loop function. I want optim to estimates al_j; au_j; sigma_j; b_j by looking at 0 to 20, 21 to 40, 41 to 60 data points. The final result should have 4 columns of each of the estimates AND 4 rows of each of 0 to 20, 21 to 40, 41 to 60. ###MY code is n=20 runs=4 out=matrix(0,nrow=runs) llik = function(x) { al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4]
2009 Jul 19
1
trouble using optim for maximalisation of 2-parameter function
Hello, I am having trouble using "optim". I want to maximalise a function to its parameters [kind of like: univariate maximum likelihood estimation, but i wrote the likelihood function myself because of data issues ] When I try to optimize a function for only one parameter there is no problem: llik.expo<-function(x,lam){(length(x)*log(lam))-(length(x)*log(1-exp(-1*lam*
2004 Jun 17
0
beta regression in R
Hello, I'm using optim to program a set of mle regression procedures for non-normal disturbances. This is for teaching and expository purposes only. I've successfully programmed the normal, generalized gamma, gamma, weibull, exponential, and lognormal regression functions. And optim returns reasonable answers for all of these compared with the identical optimization problems in STATA and
2012 Nov 12
1
Invalid 'times' argument three-category ordered probit with maximum likelihood
Hello, First time poster here so let me know if you need any more information. I am trying to run an ordered probit with maximum likelihood model in R with a very simple model (model <- econ3 ~ partyid). Everything looks ok until i try to run the optim() command and that's when I get " Error in rep(1, nrow(x)) : invalid 'times' argument". I had to adapt the code from a 4
2009 Jul 01
0
probit with sample selection error?
Deal all: i want to do the probit with sample selection estimation, the following is my code: probit with sample selection can be done by stata :heckprob The heckprobll is the likelihood function shown in W.H. Greene 5th p714 ¡´ The question is the convergence is very slow compare with Stata using likellihood only. ¡´ Second i did the similar way in matlab using fminsearch , the estimated
2012 Feb 01
3
Probit regression with limited parameter space
Dear R helpers, I need to estimate a probit model with box constraints placed on several of the model parameters. I have the following two questions: 1) How are the standard errors calclulated in glm (family=binomial(link="probit")? I ran a typical probit model using the glm probit link and the nlminb function with my own coding of the loglikehood, separately. As nlminb does not
2011 Jul 01
2
Help fix last line of my optimization code
Hi I need help figure out how to fix my code. When I call into R >optimize(llik,init.params=F) I get this error message ####Error in optimize(llik, init.params = F) : element 1 is empty; the part of the args list of 'min' being evaluated was: (interval)#### My data and my code looks like below. R_j R_m 0.002 0.026567296 0.01 0.003194435 . . . . . . . . 0.0006
2004 Mar 05
4
Probit predictions outside (0,1) interval
Hi! I was trying to implement a probit model on a dichotomous outcome variable and found that the predictions were outside the (0,1) interval that one should get. I later tried it with some simulated data with a similar result. Here is a toy program I wrote and I cant figure why I should be getting such odd predictions. x1<-rnorm(1000) x2<-rnorm(1000) x3<-rnorm(1000)
2002 Aug 27
5
probit etc. for dose-response modeling
Hello all I have done some fitting of pnorm functions to dose-response data, so I could calculate EC50 values (dose where the response is 0.5). I used the nlm function for this, so I did not get any information about the confidence intervals of the fitted parameters. What would be a good way to do such a probit fit, or is there a package which I could use? Best regards Johannes Ranke
2011 Jul 03
3
Hint improve my code
Hi I have developed the code below. I am worried that the parameters I want to be estimated are "not being found" when I ran my code. Is there a way I can code them so that R recognize that they should be estimated. This is the error I am getting. > out1=optim(llik,par=start.par) Error in pnorm(au_j, mean = b_j * R_m, sd = sigma_j) : object 'au_j' not found #Yet
2010 May 06
2
Derivative of the probit
Is there a function to compute the derivative of the probit (qnorm) function in R, or in any of the packages? Thanks, -Andrew [[alternative HTML version deleted]]
2011 Jul 23
1
Extend my code to run several data at once.
Hi I have a code that calculate maximisation using optimx and it is working just fine. I want to extend the code to run several colomns of R_j where j runs from 1 to 200. If I am to run the code in its current state, it means I will have to run it 200 times manually. May you help me adjust it to accomodate several rows of R_j and print the 200 results. ***Please do not get intimidated by the
2012 Mar 21
0
multivariate ordinal probit regression vglm()
Hello, all. I'm investigating the rate at which skeletal joint surfaces pass through a series of ordered stages (changes in morphology). Current statistical methods in this type of research use various logit or probit regression techniques (e.g., proportional odds logit/probit, forward/backward continuation ratio, or restricted/unrestricted cumulative probit). Data typically include the
2012 Apr 04
0
multivariate ordered probit regression---use standard bivariate normal distribution?
Hello. I have yet to receive a response to my previous post, so I may have done a poor job asking the question. So, here is the general question: how can I run a run a multivariate (more than one non-independent, response variables) ordered probit regression model? I've had success doing this in the univariate case using the vglm() function in the VGAM package. For example:
2004 Jun 12
2
ordered probit or logit / recursive regression
> I make a study in health econometrics and have a categorical > dependent variable (take value 1-5). I would like to fit an ordered > probit or ordered logit but i didn't find a command or package who > make that. Does anyone know if it's exists ? R is very fancy. You won't get mundane things like ordered probit off the shelf. (I will be very happy if someone will show
2003 Nov 06
1
for help about R--probit
Not real data. It was gererated randomly. The original codes are the following: par(mfrow=c(2,1)) n <- 500 ######################### #DATA GENERATING PROCESS# ######################### x1 <- rnorm(n,0,1) x2 <- rchisq(n,df=3,ncp=0)-3 sigma <- 1 u1 <- rnorm(n,0,sigma) ylatent1 <-x1+x2+u1 y1 <- (ylatent1 >=0) # create the binary indicator ####################### #THE
2003 Jun 21
0
how to get a probit scale in R?
Hi, If you plot a cumulative histogram of a gausian distribution, using a log scale on the x-axis and a probit scale on the y-axis, you get a straight line. My question is whether it is possible in R to use a "probit" scale in a "plot". For example on the following webpage you can see an application of how I would like to use a probit scale:
2011 Apr 25
0
probit regression marginal effects
Dear R-community, I am currently replicating a study and obtain mostly the same results as the author. At one point, however, I calculate marginal effects that seem to be unrealistically small. I would greatly appreciate if you could have a look at my reasoning and the code below and see if I am mistaken at one point or another. My sample contains 24535 observations, the dependent variable