search for: au_j

Displaying 5 results from an estimated 5 matches for "au_j".

2011 Jul 03
3
Hint improve my code
...eveloped 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 al_j,au_j,sigma_j and b_j are just estimates that balance the likelihood function? llik=function(R_j,R_m) if(R_j< 0) { sum[log(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+al_j-b_j*R_m))^2] }else if(R_j>0) { sum[log...
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=...
2011 Jul 23
1
Extend my code to run several data at once.
...n 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 maths in the code.*** my code ###### afull=read.table("D:/hope.txt",header=T) library(optimx) llik = function(x) { al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4] sum(na.rm=T, ifelse(a$R_j< 0, log(1 / ( sqrt(2*pi) * sigma_j) )- (1/( 2*sigma_j^2 ) ) * ( (a$R_j+al_j-b_j*a$R_m)^2 ) , ifelse(a$R_j>0 , log(1 / ( sqrt(2*pi) * sigma_j) )- (1/( 2*sigma_j...
2011 Jul 06
1
Group Data indexed by n Variables
...Y"), "%m") MonthDayCombs = paste(Months, Days) AvgDemand = data.matrix(by(Data$RescaledDemand, DayMonthCombs, mean)) On 4 July 2011 10:34, EdBo <n.bowora@gmail.com> wrote: > 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...
2011 Jul 01
2
Help fix last line of my optimization code
...f 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 0.010281122 a=read.table("D:/ff.txt",header=T) attach(a) llik=function(R_j,R_m) #The parameters al_j, au_j, b_j , and sigma_j need to be estimated and there are no initial estimates to them. if(R_j< 0) { LF=sum[log(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+al_j-b_j*R_m))^2] }else if(R_j>0) { LF=sum[log(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+au_j-b_j*R_m))^2] }else { LF=sum[(log(pnorm...