search for: y_i

Displaying 20 results from an estimated 111 matches for "y_i".

Did you mean: _i
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis. The following is the 'hierarchy' of models I would like to test: (1) Y_i = a + integral[ X_i(t)*Beta(t) dt ] (2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ] (3) Y_i = a + integral[ F{X_i(t),t} dt ] equivalents for discrete data might be: 1) Y_i = a + sum_t[ L_t * X_it * Beta_t ] (2) Y_i = a + sum_t[ L_t * F{X_it} * Beta_t ] (3) Y_i = a + sum_t[ L_t * F{X_it,t}...
2010 Feb 06
1
Canberra distance
Hi the list, According to what I know, the Canberra distance between X et Y is : sum[ (|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function 'absolute value') In the source code of the canberra distance in the file distance.c, we find : sum = fabs(x[i1] + x[i2]); diff = fabs(x[i1] - x[i2]); dev = diff/sum; which correspond to the formula : sum[ (|x_i - y_i|) / (...
2008 May 23
1
maximizing the gamma likelihood
for learning purposes and also to help someone, i used roger peng's document to get the mle's of the gamma where the gamma is defined as f(y_i) = (1/gammafunction(shape)) * (scale^shape) * (y_i^(shape-1)) * exp(-scale*y_i) ( i'm defining the scale as lambda rather than 1/lambda. various books define it differently ). i found the likelihood to be n*shape*log(scale) + (shape-1)*sum(log(y_i) - scale*sum(y_i) then i wrote below whi...
2013 Jun 23
1
2SLS / TSLS / SEM non-linear
Dear all, I try to conduct a SEM / two stage least squares regression with the following equations: First: X ~ IV1 + IV2 * Y Second: Y ~ a + b X therein, IV1 and IV2 are the two instruments I would like to use. the structure I would like to maintain as the model is derived from economic theory. My problem here is that I have trouble solving the equations to get the reduced form so I can run
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as sum(|x_i - y_i| / |x_i + y_i|) Obviously this is undefined for cases where both x_i and y_i are zeros. Since double zeros are common in many data sets, this is a nuisance. In our field (from which the distance is coming), it is customary to remove double zeros: contribution to distance is zero when both x_i...
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as sum(|x_i - y_i| / |x_i + y_i|) Obviously this is undefined for cases where both x_i and y_i are zeros. Since double zeros are common in many data sets, this is a nuisance. In our field (from which the distance is coming), it is customary to remove double zeros: contribution to distance is zero when both x_i...
2007 Feb 01
3
Help with efficient double sum of max (X_i, Y_i) (X & Y vectors)
...nvolves double sums of max(X_i,Y_j) where X and Y are vectors of differing length. I am currently using ifelse pointwise in a vector, but have a nagging suspicion that there is a more efficient way to do this. Basically, I require three sums: sum1: \sum_i\sum_j max(X_i,X_j) sum2: \sum_i\sum_j max(Y_i,Y_j) sum3: \sum_i\sum_j max(X_i,Y_j) Here is my current implementation - any pointers to more efficient computation greatly appreciated. nx <- length(x) ny <- length(y) sum1 <- 0 sum3 <- 0 for(i in 1:nx) { sum1 <- sum1 + sum(ifelse(x[i]>x,x[i],x)) sum3 &l...
2013 Oct 19
2
ivreg with fixed effect in R?
I want to estimate the following fixed effect model: y_i,t = alpha_i + beta_1 x1_t + beta_2 x2_i,tx2_i,t = gamma_i + gamma_1 x1_t + gamma_2 Z1_i + gamma_3 Z2_i I can use ivreg from AER to do the iv regression. fm <- ivreg(y_i,t ~ x1_t + x2_i,t | x1_t + Z1_i + Z2_i, data = DataSet) But, I'm not sure how can I add the fixed e...
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"...
2010 Apr 25
1
function pointer question
Hello, I have the following function that receives a "function pointer" formal parameter name "fnc": loocv <- function(data, fnc) { n <- length(data.x) score <- 0 for (i in 1:n) { x_i <- data.x[-i] y_i <- data.y[-i] yhat <- fnc(x=x_i,y=y_i) score <- score + (y_i - yhat)^2 } score <- score/n return(score) } I would like to use it like this: ## ## Estimator function using Gaussian Kernel ## gaussiankernel <- function(x,y,h) { modelks &l...
2010 Feb 05
3
metafor package: effect sizes are not fully independent
In a classical meta analysis model y_i = X_i * beta_i + e_i, data {y_i} are assumed to be independent effect sizes. However, I'm encountering the following two scenarios: (1) Each source has multiple effect sizes, thus {y_i} are not fully independent with each other. (2) Each source has multiple effect sizes, each of the effect siz...
2012 Mar 20
1
MA process in panels
Dear R users, I have an unbalanced panel with an average of I=100 individuals and a total of T=1370 time intervals, i.e. T>>I. So far, I have been using the plm package. I wish to estimate a FE model like: res<-plm(x~c+v, data=pdata_frame, effect="twoways", model="within", na.action=na.omit) ?where c varies over i and t, and v represents an exogenous impact on x
2005 Nov 09
5
How to find statistics like that.
Hi there, Suppose mu is constant, and error is normally distributed with mean 0 and fixed variance s. I need to find a statistics that: Y_i = mu + beta1* I1_i beta2*I2_i + beta3*I1_i*I2_i + +error, where I_i is 1 Y_i is from group A, and 0 if Y_i is from group B. It is large when beta1=beta2=0 It is small when beta1 and/or beta2 is not equal to 0 How can I find it by R? Thank you very much for your time. Fay
2011 Mar 16
2
Re; Fitting a Beta distribution
I want to fit some p-values to a beta distribution. But the problem is some of the values have 0s and 1's. I am getting an error if I use the MASS function to do this. Is there anyway to get around this? -- Thanks, Jim. [[alternative HTML version deleted]]
2004 Apr 18
2
lm with data=(means,sds,ns)
...ues at x_i and I want to linearly regress y on x. There does not seem to be an option to 'lm' which can deal with such data directly, though the regression problem could be algebraically expressed in these terms. One way of fudging it would be to replace each m_i by a set of n_i numbers Y_i constructed as u_i <- rnorm(ni) Y_i <- m_i + s_i*(u_i - mean(u_i))/sd(u_i) and associate these with X_i <- rep(x_i,n_i), thereby constructing a regression-equivalent set of pseudo "raw data" which could be fed to lm(Y~X). However, this strikes me as cumbersome, at least, a...
2013 Jan 11
0
Manual two-way demeaning of unbalanced panel data (Wansbeek/Kapteyn transformation)
...the transformation (Ch.3), Q%*%y (with y being the dependent variable) should yield the demeaned series. However, ... ...I find that the results do not match, if I do so. ...that if I am looking at a balanced panel, I get the correct results when multiplying Q with the already demeaned series y_it, Q%*%y_it. ...that if I am looking at an unbalanced panel, I receive results which differ (even though being close). I guess I am missing something. Every comment pointing me to the right solution would be of great value to me. Also, comments on how to increase the efficiency of my function wo...
2017 Dec 03
1
Discourage the weights= option of lm with summarized data
...----------------- (A) Non-?NULL? ?weights? can be used to indicate that different observations have different variances (with the values in ?weights? being inversely proportional to the variances); (B) or equivalently, when the elements of ?weights? are positive integers w_i, that each response y_i is the mean of w_i unit-weight observations (C) (including the case that there are w_i observations equal to y_i and the data have been summarized). (D) However, in the latter case, notice that within-group variation is not used. Therefore, the sigma estimate and residual degrees of freedom may...
2009 Nov 12
1
naive "collinear" weighted linear regression
...gin and slope equal to 2 > error <- c(0.3,0.3,0.3,0.3) # I have (equal) ``errors'', for instance, in the measured responses Of course the best fit coefficients should be 0 for the intercept and 2 for the slope. Furthermore, it seems completely plausible (or not?) that, since the y_i have associated non-vanishing ``errors'' (dispersions), there should be corresponding non-vanishing ``errors'' associated to the best fit coefficients, right? When I try: > fit_mod <- lm(y~x,weights=1/error^2) I get Warning message: In lm.fit(x, y, offset = offset, sing...
2018 Mar 15
3
stats 'dist' euclidean distance calculation
...subset used Locus1 Locus2 Locus3 Samp1 GG <NA> GG Samp2 AG CA GA Samp3 AG CA GG The euclidean distance function is defined as: sqrt(sum((x_i - y_i)^2)) My assumption was that the difference between x_i and y_i would be the number of allelic differences at each base pair site between samples. For example, the euclidean distance between Samp1 and Samp2 would be: euclidean distance = sqrt( S1_L1 - S2_L1)^2 + (S1_L2 - S2_L2)^2 + (S1_L3 - S2_L3)^...
2007 Mar 09
1
help with zicounts
...s log(?_{i})=x_{i}*gamma 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