search for: z_i

Displaying 19 results from an estimated 19 matches for "z_i".

Did you mean: _i
2011 Apr 22
1
How to generate normal mixture random variables with given covariance function
Dear All, Suppose Z_i, i=1,...,m are marginally identically distributed as a two normal mixture p0*N(0,1) + (1-p0) *N( miu_i, 1) where miu_i are identically distributed according to a mixture and I have generated Z_i one by one . Now suppose these m random variables are jointly m-dimensional normal with correlation...
2013 Feb 18
2
error: Error in if (is.na(f0$objective)) { : argument is of length zero
...ctor) of type 'NULL' Here is the syntax itself: library('nloptr') library('pracma') # objective function f <- function(x,s) {m<-100 t<-2*m+1 H<-matrix(data=NA,nrow=t,ncol=t) I<-diag(t) delta<-2*x[1]/t z<--x[1]+.5*delta range1<-t for (i in 1:range1){ z_i=-x[1]+(i-.5)*delta for (j in 1:range1){ up<-(((-x[1]+j*delta-(1-x[2])*z_i)/x[2]))-s down<-(((-x[1]+(j-1)*delta-(1-x[2])*z_i)/x[2]))-s H[i,j]<-pnorm(up,mean=0,sd=1)-pnorm(down,mean=0,sd=1)} } K<-solve(I-H) one <- matrix(1,nrow=t,ncol=1) u &lt...
2007 Mar 09
1
help with zicounts
...a with gamma=1. beta.true<-1.0 gamma.true<-1.0 n<-1000 x<-matrix(rnorm(n),n,1) pi<-expit(x*beta.true) mu<-exp(x*gamma.true) y<-numeric(n) # blank vector z<-(runif(n)<pi) # logical: T with prob p_i, F otherwise y[z]<-rpois(sum(z),mu[z]) # draw y_i ~ Poisson(mu_i) where z_i = T y[!z]<-0 # set y_i = 0 where z_i = F Thanks for your time! Jacob Jacob L van Wyk Department of Statistics University of Johannesburg, APK P O Box 524 Auckland Park 2006 South Africa Tel: +27 11 489 3080 Fax: +27 11 489 2832
2010 Jul 13
1
Batch file export
...rates data vectors within R. For example assume: z <- rlnorm(1000, meanlog = 0, sdlog = 1) Every time a vector has been generated I would like to export it into a csv file. So my idea is something as follows: for (i in 1:100) { z <- rlnorm(1000, meanlog = 0, sdlog = 1) write.csv(z, "c:/z_i.csv") Where "z_i.csv" is a filename that is related to the run (e.g. z_001.csv, z_002.csv, ...). Could anyone please advice me on the most convenient way of doing this? Thanks very much in advance, Michael [[alternative HTML version deleted]]
2010 Nov 03
1
Orthogonalization with different inner products
Suppose one wanted to consider random variables X_1,...X_n and from each subtract off the piece which is correlated with the previous variables in the list. i.e. make new variables Z_i so that Z_1=X_1 and Z_i=X_i-cov(X_i,Z_1)Z_1/var(Z_1)-...- cov(X_i,Z__{i-1})Z__{i-1}/var(Z_{i-1}) I have code to do this but I keep getting a "non-conformable array" error in the line with the covariance. Does anyone have any suggestions? Here is my code: gov=read.table(file.choose(),...
2013 Feb 27
0
A program running for a too long time
...eping the value of m at 100. 2-increase the number of iterations in romberg. library('nloptr') library('pracma') f <- function(x,y) {m<-100 t<-2*m+1 H<-matrix(data=NA,nrow=t,ncol=t) I<-diag(t) delta<-2*x[1]/t z<--x[1]+.5*delta range1<-t for (i in 1:range1){ z_i=-x[1]+(i-.5)*delta for (j in 1:range1){ up<-(((-x[1]+j*delta-(1-x[2])*z_i)/x[2]))-y down<-(((-x[1]+(j-1)*delta-(1-x[2])*z_i)/x[2]))-y H[i,j]<-pnorm(up,mean=0,sd=1)-pnorm(down,mean=0,sd=1)} } K<-solve(I-H) one <- matrix(1,nrow=t,ncol=1) u &l...
2007 Jun 14
0
random effects in logistic regression (lmer)-- identification question
...a conceptual problem that I expect one of you can clear up for me. The question is about random effects in the context of a model fit with a binomial family and logit link. Unlike an ordinary linear regression, there is no way to estimate an individual level random error in the linear predictor z_i = a + b*x_i + e_i because the variance of e_i is unidentified. The standard deviation of the logistic is pi*s/3, and we assume s=1, so the standard deviation is assumed to be pi/3 (just a bit bigger than 1, if you are comparing against the Standard Normal). The logistic fitting process sets the...
2008 Oct 30
0
a nlm() question
Dear R listers, I have a very annoying problem using nlm(). I want to find the minimizer of my target function, if written in \LaTeX is f(\mu1,\mu2,\sigma1,\sigma2) = \sum_i^n( w_ig_t(z_i) ), where g_t(z) is a pdf of bivariate normal distribution and z_i is my samples. I cannot get the estimation result generated by nlm(), and I got the following errors " Error in nlm(foo, theta.start, hessian = TRUE) : non-finite value supplied by 'nlm' " from...
2003 Oct 23
1
Variance-covariance matrix for beta hat and b hat from lme
Dear all, Given a LME model (following the notation of Pinheiro and Bates 2000) y_i = X_i*beta + Z_i*b_i + e_i, is it possible to extract the variance-covariance matrix for the estimated beta_i hat and b_i hat from the lme fitted object? The reason for needing this is because I want to have interval prediction on the predicted values (at level = 0:1). The "predict.lme" seems to provide...
2010 May 18
1
Maximization of quadratic forms
...\beta)$ for a fixed covariance matrix where $\beta$ and $\mu$ are low- dimensional. More specifically, for fixed variance-covariance matrices $\Sigma_{z=0}$ and $\Sigma_{z=1}$ (according to a binary covariate $Z $), I am trying to minimize: $\sum_{i=1^n} (Y_i-\mu_(Data_i,\beta))' \Sigma_{z=z_i}^{-1} (Y_i- \mu_(Data_i,\beta))$ in terms of the parameter $\beta$. Is there a way to do this in R in a more stable and efficient fashion than just using a general optimization function such as optim? I have tried to use gnls, but I was unsuccessful in specifying different values of the cov...
2007 Apr 12
1
LME: internal workings of QR factorization
...ensity in a form to mimic a single least squares problem conditional upon the variance parameters. The paper is fairly clear except that some important level of detail is missing. For instance, when we first meet Q_(i): / \ / \ | Z_i X_i y_i | | R_11(i) R_10(i) c_1(i) | | | = Q_(i) | | | Delta 0 0 | | 0 R_00(i) c_0(i) | \ / \ /...
2001 Oct 09
1
PROC MIXED user trying to use (n)lme...
Dear R-users Coming from a proc mixed (SAS) background I am trying to get into the use of (n)lme. In this connection, I have some (presumably stupid) questions which I am sure someone out there can answer: 1) With proc mixed it is easy to get a hold on the estimated variance parameters as they can be put out into a SAS data set. How do I do the same with lme-objects? For example, I can see the
2004 Apr 28
4
numericDeriv
Dear All, I am trying to solve a Generalized Method of Moments problem which necessitate the gradient of moments computation to get the standard errors of estimates. I know optim does not output the gradient, but I can use numericDeriv to get that. My question is: is this the best function to do this? Thank you Jean,
2004 Apr 05
3
2 lme questions
Greetings, 1) Is there a nice way of extracting the variance estimates from an lme fit? They don't seem to be part of the lme object. 2) In a series of simulations, I am finding that with ML fitting one of my random effect variances is sometimes being estimated as essentially zero with massive CI instead of the finite value it should have, whilst using REML I get the expected value. I guess
2000 Aug 11
0
Index of predictive association
...estion is nearly always ``yes.'' Perhaps I should have asked, ``How can I do this in R?'') 2) Is it reasonable to try this with a 3-dimensional array? The way I thought of doing it (say, the variables are x, y, and z, with z being the outcome) involves calculating the probability of z_i conditional on knowing both x and y. This leads to some funny stuff, which makes me doubt if I'm doing it right. Perhaps I should condition on only one of x and y at a time? Any help would be appreciated. ______________________________________________________________________ Stuart Luppescu...
2007 Apr 12
0
LME: internal workings of QR factorization --repost
...sity in a form to mimic a single least squares problem conditional upon the variance parameters. The paper is fairly clear except that some important level of detail is missing. For instance, when we first meet Q_(i): / \ / \ | Z_i X_i y_i | | R_11(i) R_10(i) c_1(i) | | | = Q_(i) | | | Delta 0 0 | | 0 R_00(i) c_0(i) | \ / \ /...
2010 Feb 18
0
lme - incorporating measurement error with estimated V-C matrix
I have data (each Y_i is a vector) in the form of Y_i = X_i \beta_i + Z_i b_i + epsilon_i Were it not for the measurement error (the epsilon_i) it's a very simple model --- nice and balanced, compound symmetry, and I'd just use lme(y ~ x1 + x2, random=~1|subj, ...) but the measurement error is throwing me off. Because the Y_i are actually derived from...
2011 Jun 16
0
Update: Is there an implementation of loess with more than 3 parametric predictors or a trick to a similar effect?
...007-January/124064.html My situation is different in that I have only 2 predictors (coordinates x,y) for local regression but a number of global ("parametric") offsets that I need to consider. Essentially, we have a spatial distortion s(x,y) overlaid over a number of measurements z: z_i = s(x_i,y_i) + v_{g_i} These measurements z can be grouped by the same underlying undistorted measurement value v for each group g. The group membership g_i is known for each measurement, but the underlying undistorted measurement values v_g for the groups are not known and should be determined by...
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
...zPu5iEgSXM)bk*Bge1 at jf1lcU1(`x$EuGOl44Bw~KL{(eo`0EsCRvI6HPIO%v2_fs4 zO8&S6o^x#Rfwx5Tpb%Pgk{-{lPLM4Zt`y!A>jZ4_>k)kdGfw!B5j>%moKRUAsezYZ z9(OR0JDA7SlH(0yPNI{VQ#Hk>@fvYyD%}k#l^Vg%F>QUW(ydW#(RyOSvfX{e#$@O9 zxOmm<BDl8{B&Q4~7e{fanxuT_B>FcH8i8+Av3!tB6^H{tZkRifVSw4!S;7)565Ggi z_iAk&T+^Ip6bC*t+`B9f)YS=`W|!b3iUWr+;n_&`{fyH@`3}qW#ah=vcWCGMK8VAX zBq6?36M-*b9VBUnAaChuVJJ7;wn;j_+mo!+gS at Fq_fwSBh&ul%DA{#Qw{1~nC$FU2 zzmBP7tcQ+~s&GuDwoQf)3ilFq217g&&m1&F<q9fx+x}mv98Wh9wN`$M?@dirXq^#m zox5DOP8m%PhqzOroYr<CoY*LAnnNbK{UP$EtMzO`<ONz{dx2<oCrMe}7=!...