search for: r_j

Displaying 7 results from an estimated 7 matches for "r_j".

Did you mean: r_
2011 Jul 03
3
Hint improve my code
...nize 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(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+au_j-b_j*R_m))^2] }else if(R_j==0) { sum(log(pnorm(au_j,mean=b_j*R_m,sd=sigma_j)-pnorm(al_j,mean=b_j*R_m,sd=sigma_j))) } start.par=...
2011 Jul 01
2
Help fix last line of my optimization code
...re 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 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(...
2011 Jul 04
3
loop in optim
...1 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] sum(na.rm=T, ifelse(a$R_j< 0, -log(1/(2*pi*(sigma_j^2)))- (1/(2*(sigma_j^2))*(a$R_j+al_j-b_j*a$R_m))^2, ifelse(a$R_j>0 , -log(1/(2*pi*(sigma_j^2)))- (1/(2*(sigma_j^2))*(a$R_j+au_j-b_j*a$R_m))^2, -log(pnorm(au_j,mean=b_j*a$R_m,sd=...
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 maths in the code.*** my code ###### afull=re...
2011 Jul 06
1
Group Data indexed by n Variables
...umns 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] > sum(na.rm=T, > ifelse(a$R_j< 0, -log(1/(2*pi*(sigma_j^2)))- > (1/(2*(sigma_j^2))*(a$R_j+al_j-b_j*a$R_m))^2, > ifelse(a$R_j>0 , -log(1/(2*pi*(sigma_j^2)))- > (1/(2*(sigma_j^2))*(a$R_j+au_j-b_j*a$R_m))^2, > > -log(pnorm(au_j,mean=b_j*a$R_m,sd=sqrt(...
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
...mcDiagnose <- function(model){ auxRegs <- lmAuxiliary(model) auxRsq <- numeric(length=length(auxRegs)) j <- 0 for ( i in auxRegs ){ j <- j + 1 sumry <- summary(i) auxRsq[j] <- sumry$r.squared } print("Drum roll please!") print("And your R_j Squareds are (auxiliary Rsq)") print(names(auxRegs)) print(auxRsq) } x1 <- rnorm(100) x2 <- rnorm(100) y <- rnorm(100) m1 <- lm(y~x1+x2) mcDiagnose(m1) m2 <- lm(y~log(10+x1) + poly(x2,2)) mcDiagnose(m2) -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane,...
2009 May 21
1
[PATCH server] Updated look and feel for empty grid views
...?sw4ZZSoGMPQQ>)9IoL z4blV8Fo{F*GNH&)@+c?e0MGN-cyY}o$32ZL3bHgt2+8}mZn3nq#BYE18<Oa31scq- z6UV at r;F_TisySHu`}-^{EioKUTN!6>CrW`rBLr-1ZE^43Js0;$Ne~1CfuY}ZK!>c` z#n;*ugDXOZ=XuW1UNMCN3J(JfMavjN6h*{wOrE4fQA7{~6h+a{J|>mQ*ciiKuK$%Y zXV0=U=n=;uQhE(FN+PFI?#hxd42hzMvMf1u>eOuRL{SYWqlAYKAF{r_j at G)tZECG3 z$_Y{G5H7OvIHN2j49ASeA%};Dq^To#I2_tk>FjwDPb at UXjN=#;$An>swWX_1*4XI^ zgZB9GW4?IsfJ>KNBTeJ#d7=q-+PTyEWT*}KgG8p!dZ1rceV|eZ#^W)&qkTNBQOaww zIa+I1?eKlqou(8 at X^iQT<t15e$#Y8-$7ETKwM8 at CTUOFGDKwsjjt~wusC?%fC9&%u z048OQ6b>YqWz{(OQdEMQmi(PcCs_dqYr<AT6PeA>!u_?CQh...