similar to: questions about optim

Displaying 20 results from an estimated 2000 matches similar to: "questions about optim"

2018 Feb 13
3
Help with regular expressions
R 3.4.2 OS X Colleagues I would appreciate some help with regular expressions. I have string that looks like: " ITERATION ,THETA1 ,THETA2 ,THETA3 ,THETA4 ,THETA5 ,THETA6 ,THETA7 ,SIGMA(1,1) ,SIGMA(2,1) ,SIGMA(2,2)? In the entries that
2012 Mar 16
2
Elegant Code
Hi, Can anyone help to write a more elegant version of my code? I am sure this can be put into a loop but I am having trouble creating the objects b1,b2,b3,...,etc. b1 <- rigamma(50,1,1) theta1 <- rgamma(50,0.5,(1/b1)) sim1 <- rpois(50,theta1) b2 <- rigamma(50,1,1) theta2 <- rgamma(50,0.5,(1/b2)) sim2 <- rpois(50,theta2) b3 <- rigamma(50,1,1) theta3 <-
2003 Feb 22
2
4-parameter logistic model
Dear R users I'm a new user of R and I have a basic question about the 4-parameter logistic model. According to the information from Pinheiro & Bates the model is: y(x)=theta1+(theta2-theta1)/(1+exp((theta3-x)/theta4)) == y(x)=A+(B-A)/(1+exp((xmid-input)/scal)) from the graph in page 518 of the book of the same authors (mixed models in S) theta 1 corresponds to the horizontal asymptote
2018 Feb 13
0
Help with regular expressions
Hi Dennis, How about: # define the two values to search for x<-2 y<-3 # create your search string and replacement string repstring<-paste(x,y,sep=",") newstring<-paste(x,y,sep=".") # this is the string that you want to change thetastring<-"SIGMA(2,3)" sub(repstring,newstring,thetastring) [1] "SIGMA(2.3)" Use gsub if you want to change
2004 Mar 18
1
profile error on an nls object
Hello all, This is the error message that I get. > hyp.res <- nls(log(y)~log(pdf.hyperb(theta,X)), data=dataModel, + start=list(theta=thetaE0), + trace=TRUE) 45.54325 : 0.1000000 1.3862944 -4.5577142 0.0005503 3.728302 : 0.0583857346 0.4757772859 -4.9156128701 0.0005563154 1.584317 : 0.0194149477 0.3444648833 -4.9365149150 0.0004105426 1.569333 :
2018 Feb 13
1
Help with regular expressions
You can either use positive lookahead/lookbehind - but support for that is a bit flaky. Or write a proper regex, and use backreferences to keep what you need. R > x <- "abc 1,1 ,1 1, x,y 2,3 " R > gsub("(\\d),(\\d)", "\\1.\\2", x, perl = TRUE) [1] "abc 1.1 ,1 1, x,y 2.3 " B. > On Feb 12, 2018, at 9:34 PM, Jim Lemon <drjimlemon at
2009 Sep 07
1
Scan and read.table
Dear R experts.. I am trying to read data-sections in a large consolidated dataset, containing section headers and the data . There are many options available to implement, I was wondering what optimal function, to extract section headers and data (w/ columns), could be used on the dataset that looks like as provided at the end of this email? In each section of a dataset, 1st line of the section
2023 Aug 20
2
Issues when trying to fit a nonlinear regression model
Dear Bert, Thank you so much for your kind and valuable feedback. I tried finding the starting values using the approach you mentioned, then did the following to fit the nonlinear regression model: nlregmod2 <- nls(y ~ theta1 - theta2*exp(-theta3*x), start = list(theta1 = 0.37, theta2 = exp(-1.8), theta3 =
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
Dear friends, This is the dataset I am currently working with: >dput(mod14data2_random) structure(list(index = c(14L, 27L, 37L, 33L, 34L, 16L, 7L, 1L, 39L, 36L, 40L, 19L, 28L, 38L, 32L), y = c(0.44, 0.4, 0.4, 0.4, 0.4, 0.43, 0.46, 0.49, 0.41, 0.41, 0.38, 0.42, 0.41, 0.4, 0.4 ), x = c(16, 24, 32, 30, 30, 16, 12, 8, 36, 32, 36, 20, 26, 34, 28)), row.names = c(NA, -15L), class =
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Oh, sorry; I changed signs in the model, fitting theta0 + theta1*exp(theta2*x) So for theta0 - theta1*exp(-theta2*x) use theta1= -.exp(-1.8) and theta2 = +.055 as starting values. -- Bert On Sun, Aug 20, 2023 at 11:50?AM Paul Bernal <paulbernal07 at gmail.com> wrote: > Dear Bert, > > Thank you so much for your kind and valuable feedback. I tried finding the > starting
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Dear Bert, Thank you for your extremely valuable feedback. Now, I just want to understand why the signs for those starting values, given the following: > #Fiting intermediate model to get starting values > intermediatemod <- lm(log(y - .37) ~ x, data=mod14data2_random) > summary(intermediatemod) Call: lm(formula = log(y - 0.37) ~ x, data = mod14data2_random) Residuals: Min
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Basic algebra and exponentials/logs. I leave those details to you or another HelpeR. -- Bert On Sun, Aug 20, 2023 at 12:17?PM Paul Bernal <paulbernal07 at gmail.com> wrote: > Dear Bert, > > Thank you for your extremely valuable feedback. Now, I just want to > understand why the signs for those starting values, given the following: > > #Fiting intermediate model to get
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
I got starting values as follows: Noting that the minimum data value is .38, I fit the linear model log(y - .37) ~ x to get intercept = -1.8 and slope = -.055. So I used .37, exp(-1.8) and -.055 as the starting values for theta0, theta1, and theta2 in the nonlinear model. This converged without problems. Cheers, Bert On Sun, Aug 20, 2023 at 10:15?AM Paul Bernal <paulbernal07 at
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case) #------------------------------------------------------------ function1 <- function (x, theta) {a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] ) b <- x * theta[1] / theta[3]^2 return( list( a = a, b = b )) } #----------------------------------------------------------- function2<-function (x, theta) {P
2011 May 23
6
Reading Data from mle into excel?
Hi there, I ran the following code: vols=read.csv(file="C:/Documents and Settings/Hugh/My Documents/PhD/Swaption vols.csv" , header=TRUE, sep=",") X<-ts(vols[,2]) #X dcOU<-function(x,t,x0,theta,log=FALSE){ Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t) Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2]) dnorm(x,mean=Ex,sd=sqrt(Vx),log=log) }
2011 Jul 09
3
Confusing piece of R code
m0<-epxression((4*theta1*theta2-theta3^2)/(2*x*theta3^2)-0.5*theta1*x) params<-all.vars(m0) this reads all the params from m0 so theta1,2 and 3 correct? params<-params[-which(params=="x")] checks which params are multiplied by x? np<-length(params) for(i in 1:6){ esp<-get(sprintf("m%d",i-1))
2009 Oct 27
1
Poisson dpois value is too small for double precision thus corrupts loglikelihood
Hi - I have a likelihood function that involves sums of two possions: L = a*dpois(Xi,theta1)*dpois(Yi,theta2)+b*(1-c)*a*dpois(Xi,theta1+theta3)*dpois(Yi,theta2) where a,b,c,theta1,theta2,theta3 are parameters to be estimated. (Xi,Yi) are observations. However, Xi and Yi are usually big (> 20000). This causes dpois to returns 0 depending on values of theta1, theta2 and theta3. My first
2004 Feb 26
2
Structural Equation Model
Hello all! I want to estimate parameters in a MIMIC model. I have one latent variable (ksi), four reflexive indicators (y1, y2, y3 and y4) and four formative indicators (x1, x2, x3, x4). Is there a way to do it in R? I know there is the SEM library, but it seems not to be possible to specify formative indicators, that is, observed exogenous variables which causes the latent variable. Thanks,
2007 Jun 27
1
SEM model fit
I wonder if someone could explain why, when I perform confirmatory factor-analysis model using polychoric correlations why I do not get an estimated confidence interval for the RMSEA. My experience with these type models is that I would obtain a confidence interval estimate. I did not get any warning messages with the output. RESULTS: Model Chisquare = 1374 Df = 185 Pr(>Chisq) = 0
2023 Nov 07
1
non-linear regression and root finding
G'day Troels, On Mon, 6 Nov 2023 20:43:10 +0100 Troels Ring <tring at gvdnet.dk> wrote: > Thanks a lot! This was amazing. I'm not sure I see how the conditiion > pK1 < pK2 < pK3 is enforced? One way of enforcing such constraints (well, in finite computer arithemtic only "<=" can be enforced) is to rewrite the parameters as: pK1 = exp(theta1) ##