similar to: Name length of function argument? (PR#10357)

Displaying 20 results from an estimated 4000 matches similar to: "Name length of function argument? (PR#10357)"

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
2013 Apr 09
2
R crash
I have a generalized linear model to solve. I used package "geepack". When I use the correlation structure "unstructured", I get a messeage that- R GUI front-end has stopped working. Why this happens? What is the solution? The r codes are as follows: a<-read.table("d:/bmt.txt",header=T")
2001 Jan 09
3
log(0) problem in max likelihood estimation
This practical problem in maximum likelihood estimation must be encountered quite a bit. What do you do when a data point has a probability that comes out in numerical evaluation to zero? In calculating the log likelihood you then have a log(0) problem. Here is a simple example (probit) which illustrates the problem: x<-c(1,2,3,4,100) ntrials<-100 yes<-round(ntrials*pnorm((x-3)/1))
2011 Nov 30
1
How can I pick a matrix from a function? (Out Product of Gradient)
Hi all, I would like to use optim() to estimate the equation by the log-likelihood function and gradient function which I had written. I try to use OPG(Out Product of Gradient) to calculate the Hessian matrix since sometime Hessian matrix is difficult to calculate. Thus I want to pick the Gradient matrix from the gradient function. Moreover, could R show the process of calculation on gradient
2008 Jun 24
2
L-BFGS-B needs finite values of 'fn'
Hi, When I run the following code, r <- c(3,4,4,3,5,4,5,9,8,11,12,13) n <- rep(15,12) x <- c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8) x <- log10(x) fr <- function(c, alpha, beta) { P <- c + (1-c) * pnorm(alpha + beta * x) P <- pmax(pmin(P,1),0) -(sum(log(choose(n,r))) + sum(r * log(P)) + sum((n -r)* log(1-P))) } fit <- mle((fr), start = list(c
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
2008 Sep 12
1
Error in solve.default(Hessian) : system is computationally singular
Hello everyone, I'm trying to estimate the parameters of the returns series attached using the GARCH code below, but I get the following error message: Error in solve.default(Hessian) : system is computationally singular: reciprocal condition number = 0 Error in diag(solve(Hessian)) : error in evaluating the argument 'x' in selecting a method for function 'diag' Can
2009 Feb 12
1
Optim
Dear R user I follow the steps defined in Modern applied statistics page(453) to use optim. However, when I run the following code the parameters seems way off and the third parameter(p3) stayed as the initial value. below is the code: ## data da=c(418,401,416,360,411,425,537,379,484,388,486,380,394,363,405,383,392,363,398,526) ### initial values pars=c(392.25, 507.25, 0.80)
2005 Sep 25
2
getting variable length numerical gradient
Hi all. I have a numerical function f(x), with x being a vector of generic size (say k=4), and I wanna take the numerically computed gradient, using deriv or numericDeriv (or something else). My difficulties here are that in deriv and numericDeric the function is passed as an expression, and one have to pass the list of variables involved as a char vector... So, it's a pure R programming
2008 Sep 18
2
Difficulty understanding sem errors / failed confirmatory factor analysis
Hello, I'm trying to fit a pretty simple confirmatory factor analysis using the sem package. There's a CFA example in the examples, which is helpful, but the output for my (failing) model is hard to understand. I'd be interested in any other ways to do a CFA in R, if this proves troublesome. The CFA is replicating a 5 uncorrelated-factor structure (for those interested, it is a
2008 Jun 16
1
Error in maximum likelihood estimation.
Dear UseRs, I wrote the following function to use MLE. --------------------------------------------- mlog <- function(theta, nx = 1, nz = 1, dt){ beta <- matrix(theta[1:(nx+1)], ncol = 1) delta <- matrix(theta[(nx+2):(nx+nz+1)], ncol = 1) sigma2 <- theta[nx+nz+2] gamma <- theta[nx+nz+3] y <- as.matrix(dt[, 1], ncol = 1) x <- as.matrix(data.frame(1,
2008 Jan 31
3
Log rank test power calculations
Does anyone have any ideas how I could do a power calculation for a log rank test. I would like to know what the suggested sample sizes would be to pick a difference when the control to active are in a ratio of 80% to 20%. Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Email: daniel.brewer at icr.ac.uk
2005 Oct 06
2
data.frame error using sem package
I keep getting this error when I try to use the sem package. I and another person who has successfully used the sem package for similar analysis (fMRI effective connectivity) cannot figure out what is wrong with my code. I would appreciate any suggestions. The error message: Error in data.frame(object$coeff, se, z, 2 * (1 - pnorm(abs(z))), par.code) : arguments imply differing
2008 Nov 24
6
optimization problem
Dear list, hi ! I am a R beginner and I have a function to optimize . alpha = argmin{ f(x,alpha) } I want alpha to be in [0,1]. Is there any function that can work? I use nlm() but i can't fix the domain of alpha. thanks in advance _______________________ Jiang Peng, Ph.D. Candidate Department of Mathematics & Antai college of Economics and Management Shanghai Jiao
2004 Sep 21
1
Problems with boot and optim
I am trying to bootstrap the parameters for a model that is estimated through the optim() function and find that when I make the call to boot, it runs but returns the exact same estimate for all of the bootstrap estimates. I managed to replicate the same problem using a glm() model but was able to fix it when I made a call to the variables as data frame by their exact names. But no matter how I
2010 Jul 19
3
Reshaping data
Dear All, I have some data in the following shape: ID begin_t1 end_t1 begin_t2 end_t2 Thomas 11/03/04 13/05/06 04/02/07 16/05/08 ... ... ... ... ... Jens 24/01/02 23/05/03 07/06/03 14/11/05 I would like to reshape this data to have the following form: ID Begin_Time End_Time Thomas 11/03/04 13/05/06 Thomas 04/02/07 16/05/08 ... ... ... Jens 24/01/02 23/05/03 Jens
2010 Jan 29
3
Vector from Matrix
Dear Mailing List Members, the problem I've been grappling with für quite some time now is the following: I have a 100 rows x 200 columns matrix. data.set <- matrix(rnorm(20000, 100, 200)) Now I would like to get a vector of length 100 which collects the values from the following procedure: Take the sum of the minima of the two values from each row of columns 1 and 101, and divide it
2003 Sep 08
1
Probit and optim in R
I have had some weird results using the optim() function. I wrote a probit likelihood and wanted to run it with optim() with simulated data. I did not include a gradient at first and found that optim() would not even iterate using BFGS and would only occasionally work using SANN. I programmed in the gradient and it iterates fine but the estimates it returns are wrong. The simulated data work
2007 Dec 02
1
speeding up likelihood computation
R Users: I am trying to estimate a model of fertility behaviour using birth history data with maximum likelihood. My code works but is extremely slow (because of several for loops and my programming inefficiencies); when I use the genetic algorithm to optimize the likelihood function, it takes several days to complete (on a machine with Intel Core 2 processor [2.66GHz] and 2.99 GB RAM). Computing
2010 Mar 23
2
Transform data set
Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Close lrplaceself lrplaceParty1 lrplaceParty2 ... party1 2 4 5 party2 5 6 4 party1 6 2 1 etc... I want to format the data set so it looks like this: Party_Close