Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-22 Thread ufuk beyaztas
Dear ted, thanks for your help. Now, everything is more clear. I read
something about linear separation you mentioned, and my data set is very
suitable for this problem.  But, there is a confusing question for me;

I can not controll the process adequately because of usage of bootstrap. So,
this warnings will arise. 
After the analyse, If  I interpret the result with these warnings, does this
right? At least i may control the warnings glm.fit: algorithm did not
converge with gm.control, but fitted probabilities numerically 0 or 1
occurred will certainly arise. Does the interpretation of results with this
warning right?

Many thanks.

-
Best regards

Ufuk
--
View this message in context: 
http://r.789695.n4.nabble.com/glm-fit-fitted-probabilities-numerically-0-or-1-occurred-tp4490722p4496710.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-21 Thread ufuk beyaztas
Dear Ellison, 
Many thanks for your reply.

The information you typed is clear and now I know what to do.  Your
suggestion about finding some coffee while running simulation is so good =)

Regards

-
Best regards

Ufuk
--
View this message in context: 
http://r.789695.n4.nabble.com/glm-fit-fitted-probabilities-numerically-0-or-1-occurred-tp4490722p4492436.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-20 Thread ufuk beyaztas
Hi all,

I am doing bootstrap with logistic regression by using glm function, and I
get the errors;

glm.fit: fitted probabilities numerically 0 or 1 occurred and
glm.fit: algorithm did not converge

I have read some things about this issue in the mailing list. I can guess
what was the problem. My data contains one or may be two outliers. Does the
error occur due to these extreme values or something else such as MLE? Is
there any way to to fix this problem? 

Regards,

Ufuk

-
Best regards

Ufuk
--
View this message in context: 
http://r.789695.n4.nabble.com/glm-fit-fitted-probabilities-numerically-0-or-1-occurred-tp4490722p4490722.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Robust Statistics for Outlier Detection

2011-04-09 Thread ufuk beyaztas
Hi Dear All,

Can someone give me a suggestion about which robust statistics are most
appropriate for outlier detection in linear models, and is available with R
?

Thanks for any idea.

--
View this message in context: 
http://r.789695.n4.nabble.com/Robust-Statistics-for-Outlier-Detection-tp3438493p3438493.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why unique(sample) decreases the performance ?

2011-03-20 Thread ufuk beyaztas
Hi,

I' am interested in differences between sample's result when samples consist
of full elements and consist of only distinct elements. When sample consist
of full elements it take about 120 sec., but when consist of only distinct
elements it take about 4.5 or 5 times more sec. I expected that opposite of
this result, because unique(sample) has less elements than full sample. Code
as follows;

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion

X - matrix(c(x0,x1,x2,x3,x4),ncol=5)
Y - matrix(y,ncol=1)
Design.data - cbind(X, Y)
 
for (j in 1:nrow(X)) {

result - vector(list, )

for( i in 1: 3100) {

data - Design.data[sample(50,50,replace=TRUE),] # and
unique(Design.data.)
dataX - data[,1:5]
dataY - data[,6]

B.cap.simulation - solve(crossprod(dataX)) %*% crossprod(dataX, dataY)
P.simulation - dataX %*% solve(crossprod(dataX)) %*% t(dataX)
Y.cap.simulation - P.simulation %*% dataY
e.simulation - dataY - Y.cap.simulation
dX.simulation - nrow(dataX) - ncol(dataX)
var.cap.simulation - crossprod(e.simulation) / (dX.simulation)
ei.simulation - as.vector(dataY - dataX %*% B.cap.simulation)
pi.simulation - diag(P.simulation)
var.cap.i.simulation - (((dX.simulation) *
var.cap.simulation)/(dX.simulation - 1)) -
(ei.simulation^2/((dX.simulation - 1) * (1 - pi.simulation)))
ti.simulation - ei.simulation / sqrt(var.cap.simulation * (1 -
pi.simulation))
ti.star.simulation - ei.simulation / sqrt(var.cap.i.simulation * (1 -
pi.simulation))
pi.star.simulation - pi.simulation + ei.simulation^2 /
crossprod(e.simulation)
WKi.simulation - (ti.star.simulation)*sqrt(pi.simulation/(1-pi.simulation))
Wi.simulation - WKi.simulation * sqrt((nrow(dataX)-1)/(1-pi.simulation))

result[[i]] - list(outWi.simulation=(Wi.simulation),influ.obs = any (dataY
==Y[j,] ))

}

i.obs - sapply(result,function(x) {x$influ.obs})
ni.result - result[! i.obs]
ni.Wi.simulation - sapply(ni.result,function(x) {x$outWi.simulation})
if (j==1) {
ni.Wi.simulation1 -  ni.Wi.simulation
}else if (j==2) {
ni.Wi.simulation49 -  matrix(ni.Wi.simulation , nrow=1)

}else{
ni.Wi.simulation49
-cbind(ni.Wi.simulation49,matrix(ni.Wi.simulation,nrow=1))
}
}

Can someone give me an idea ? Many thanks.

--
View this message in context: 
http://r.789695.n4.nabble.com/Why-unique-sample-decreases-the-performance-tp3391199p3391199.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Why unique(sample) decreases the performance ?

2011-03-20 Thread ufuk beyaztas
Sorry, the last part of code does not work when uniqu() are used, the true
version;

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion

X - matrix(c(x0,x1,x2,x3,x4),ncol=5)
Y - matrix(y,ncol=1)
Design.data - cbind(X, Y)
 
for (j in 1:nrow(X)) {

result - vector(list, )

for( i in 1: 3100) {

data - Design.data[sample(50,50,replace=TRUE),] # and
unique(Design.data.)
dataX - data[,1:5]
dataY - data[,6]

B.cap.simulation - solve(crossprod(dataX)) %*% crossprod(dataX, dataY)
P.simulation - dataX %*% solve(crossprod(dataX)) %*% t(dataX)
Y.cap.simulation - P.simulation %*% dataY
e.simulation - dataY - Y.cap.simulation
dX.simulation - nrow(dataX) - ncol(dataX)
var.cap.simulation - crossprod(e.simulation) / (dX.simulation)
ei.simulation - as.vector(dataY - dataX %*% B.cap.simulation)
pi.simulation - diag(P.simulation)
var.cap.i.simulation - (((dX.simulation) *
var.cap.simulation)/(dX.simulation - 1)) -
(ei.simulation^2/((dX.simulation - 1) * (1 - pi.simulation)))
ti.simulation - ei.simulation / sqrt(var.cap.simulation * (1 -
pi.simulation))
ti.star.simulation - ei.simulation / sqrt(var.cap.i.simulation * (1 -
pi.simulation))
pi.star.simulation - pi.simulation + ei.simulation^2 /
crossprod(e.simulation)
WKi.simulation - (ti.star.simulation)*sqrt(pi.simulation/(1-pi.simulation))
Wi.simulation - WKi.simulation * sqrt((nrow(dataX)-1)/(1-pi.simulation))

result[[i]] - list(outWi.simulation=(Wi.simulation),influ.obs = any (dataY
==Y[j,] ))

}

i.obs - sapply(result,function(x) {x$influ.obs})
ni.result - result[! i.obs]
ni.Wi.simulation - sapply(ni.result,function(x) {x$outWi.simulation})
if (j==1) {
ni.Wi.simulation1 -  ni.Wi.simulation
}else if (j==2) {
ni.Wi.simulation49 -  ni.Wi.simulation

}else{
ni.Wi.simulation49 -c(ni.Wi.simulation49, ni.Wi.simulation)
}
} 

--
View this message in context: 
http://r.789695.n4.nabble.com/Why-unique-sample-decreases-the-performance-tp3391199p3391522.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A question about list

2011-03-18 Thread ufuk beyaztas
Many thanks to all

--
View this message in context: 
http://r.789695.n4.nabble.com/A-question-about-list-tp3385711p3387410.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] A question about list

2011-03-17 Thread ufuk beyaztas
Hi dear all,

It may be a simple question, i have a list output with different number of
elements as following;

[[1]]
 [1]  0.86801402 -0.82974691  0.3974 -0.98566707 -4.96576856 -1.32056754
 [7] -5.54093319 -0.07600462 -1.34457280 -1.04080125  1.62843297 -0.20473912
[13]  0.30659907  2.66908117  2.53791837  0.53788013 -0.57463077  0.27708874
[19] -2.94233200  1.54565643 -6.83694100  7.21556266 -3.14823536 -1.34590796
[25]  0.78660855  5.53692735  1.22511890  7.65249980 -0.43008997 -0.10536125

[[2]]
 [1] -2.80332826  0.54414548  4.38232256 -1.38407653 -1.59241491 -1.35509664
 [7]  1.04806755 -0.27685465 -1.36671548 -3.16649719  2.17194692 -3.49404253
[13]  4.69102017  2.78297615  0.34565006  1.05954751  1.78836097 -0.80393182
[19]  3.74315304  1.17427902  1.62354686  0.53186688 -6.56519965 -3.39045485
[25]  0.01043676 -0.18857654 -0.57070351 -0.06135564  6.92331269 -1.46544614
[31] -1.65309767

[[3]]
 [1]  4.1923546  0.6319591 -0.8568113 -3.3115788 -2.4166481 -1.1543074
 [7] -0.9333245  0.2632038 -0.6909956 -3.1008763 -2.9557687  1.5382464
[13]  1.2713290  6.6527302  1.0433603 -0.9916190 -2.7724673 -1.6554250
[19]  1.8023591 -1.5101793  1.2604704 -0.2853326 -2.4312827 -0.4731487
[25]  3.5061061  1.7392190  1.5493419 -0.7203778 -0.6995221  2.7686406
[31]  6.1813364 -1.8665294

I want to compute the percentile of all of 94 elements, i tried
quantile(data) but i got an error like
Error in sort.list(x, partial = unique(c(lo, hi))) : 
  'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
Can some one help me abouth this ?
Thanks for any idea...

--
View this message in context: 
http://r.789695.n4.nabble.com/A-question-about-list-tp3385711p3385711.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] selection of a subset from a loop

2011-02-28 Thread ufuk beyaztas
Hi dear all, 

The code like this;

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion

X - matrix(c(x0,x1,x2,x3,x4),ncol=5)
Y - matrix(y,ncol=1)
Design.data - cbind(X, Y)

result - list ()

for( i in 1: 3100) {


data - Design.data[sample(50,50,replace=TRUE),]
dataX - data[,1:5]
dataY - data[,6]

B.cap.simulation - solve(crossprod(dataX)) %*% crossprod(dataX, dataY)
P.simulation - dataX %*% solve(crossprod(dataX)) %*% t(dataX)
Y.cap.simulation - P.simulation %*% dataY
e.simulation - dataY - Y.cap.simulation
dX.simulation - nrow(dataX) - ncol(dataX)
var.cap.simulation - crossprod(e.simulation) / (dX.simulation)
ei.simulation - as.vector(dataY - dataX %*% B.cap.simulation)
pi.simulation - diag(P.simulation)
var.cap.i.simulation - (((dX.simulation) *
var.cap.simulation)/(dX.simulation - 1)) -
(ei.simulation^2/((dX.simulation - 1) * (1 - pi.simulation)))
ti.simulation - ei.simulation / sqrt(var.cap.simulation * (1 -
pi.simulation))
ti.star.simulation - ei.simulation / sqrt(var.cap.i.simulation * (1 -
pi.simulation))
pi.star.simulation - pi.simulation + ei.simulation^2 /
crossprod(e.simulation)
WKi.simulation - (ti.star.simulation)*sqrt(pi.simulation/(1-pi.simulation))

result- c(result,list(WKi.simulation))

}

Finally i get the result which contains 3100 WKi.simulation. I'm trying to
get a subset for those subset do not contain any Y[1,] that is point 10. Can
anyone help me about how to be?
Thanks for any idea...

-- 
View this message in context: 
http://r.789695.n4.nabble.com/selection-of-a-subset-from-a-loop-tp3329057p3329057.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem about for loop

2011-01-17 Thread ufuk beyaztas

Hi everyones, my function like; 

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion

data.x - matrix(c(x0,x1,x2,x3,x4),ncol=5)
data.y - matrix(y,ncol=1) 
data.k - cbind(data.x,data.y)
dataX - data.k[,1:5]
dataY - data.k[,6]

theta - function(data) {
B.cap - solve(crossprod(dataX)) %*% crossprod(dataX,dataY)
P - dataX %*% solve(crossprod(dataX)) %*% t(dataX)
Y.cap - P %*% dataY
e - dataY - Y.cap
dX - nrow(dataX) - ncol(dataX)
var.cap - crossprod(e) / (dX)
ei - as.vector(dataY - dataX %*% B.cap)
pi - diag(P)
var.cap.i - (((dX) * var.cap) / (dX - 1)) -
(ei^2 / ((dX-1) * (1 - pi)))
ti - ei / sqrt(var.cap * (1 - pi))
Ci - (ti^2 / (ncol(dataX))) * (pi / (1 - pi))
output.i - mean(Ci)}


result - list()

for ( i in 1:5){

data - replicate(1, data.k[sample(50,50,replace=T),], simplify = FALSE) 

output.j - theta(data)

result - c(result,(list(output.j))) }
table - do.call(rbind.data.frame,result)
names(table)=c(cooks)
table

This function give same results each time, the data is changing every time
but mean(Ci)s are always same.
Does anyone have an idea about how to be? Thanks for any idea 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Problem-about-for-loop-tp3221210p3221210.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] selection statistics from function

2011-01-17 Thread ufuk beyaztas

Hi,
My code:

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion
data.x - matrix(c(x0,x1,x2,x3,x4),ncol=5)
data.y - matrix(y,ncol=1)
data.k - cbind(data.x,data.y)

result - list()

for( i in 1: 3100) {
data - data.k[sample(50,50,replace=TRUE),]
dataX - data[,1:5]
dataY - data[,6]
B.cap - solve(crossprod(dataX)) %*% crossprod(dataX,dataY)
P - dataX %*% solve(crossprod(dataX)) %*% t(dataX)
Y.cap - P %*% dataY
e - dataY - Y.cap
dX - nrow(dataX) - ncol(dataX)
var.cap - crossprod(e) / (dX)
ei - as.vector(dataY - dataX %*% B.cap)
pi - diag(P)
var.cap.i - (((dX) * var.cap) / (dX - 1)) - (ei^2 / ((dX-1) * (1 - pi)))
ti - ei / sqrt(var.cap * (1 - pi))
Ci - (ti^2 / (ncol(dataX))) * (pi / (1 - pi))
result - c(result,list(mean(Ci)))}

table-do.call(rbind.data.frame,result)
names(table)=c(Cook's Distance)
table

I want to find data's statistics (mean(Ci)) which do not contain influential
observation. That is do not contain the value of 10. Can someone help me?
Thanks for advices !
-- 
View this message in context: 
http://r.789695.n4.nabble.com/selection-statistics-from-function-tp3221267p3221267.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Computing and Finding

2011-01-16 Thread ufuk beyaztas

Hi dear all, i am triying to do jackknife-after bootstrap for detection of
influential observation.
my data and resamples are following ;

e - rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 - c(rep(1,50))
x1 - rnorm(n=50,mean=2,sd=1)
x2 - rnorm(n=50,mean=2,sd=1)
x3 - rnorm(n=50,mean=2,sd=1)
x4 - rnorm(n=50,mean=2,sd=1)
y - 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10  #influential observarion

data.x - matrix(c(x0,x1,x2,x3,x4),ncol=5)
data.y - matrix(y,ncol=1)

replicate(3100, data.x[sample(50,50,replace=T),], simplify = FALSE)
replicate(3100, data.y[sample(50,50,replace=T),], simplify = FALSE)

now i want to calculate each of 3100 resamples's Cook's Distance like this
formula ;

  B.cap - solve(crossprod(data.x)) %*% crossprod(data.x, data.y)
  P - data.x %*% solve(crossprod(data.x)) %*% t(data.x)
  Y.cap - P %*% data.y
  e - data.y - Y.cap
  dX - nrow(data.x) - ncol(data.x)
  var.cap - crossprod(e) / (dX)
  ei - as.vector(data.y - data.x %*% B.cap)
  pi - diag(P)
  var.cap.i - (((dX) * var.cap)/(dX - 1)) -
(ei^2/((dX - 1) * (1 - pi)))
  ti - ei / sqrt(var.cap * (1 - pi))
  ti.star - ei / sqrt(var.cap.i * (1 - pi))
  pi.star - pi + ei^2 / crossprod(e)
  Ci - (ti^2/ncol(data.x))*(pi/(1-pi)) (Cook's Distance)

and i want to compute each of resamples, which do not include the
influential observation, Cook's Distances. Can someone help me about this ?
Thanks for any idea..


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Computing-and-Finding-tp3220423p3220423.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] selection of outputs from the function

2010-12-25 Thread ufuk beyaztas

Thanks so much Joshua Wiley you are right your function better than mine :)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/selection-of-outputs-from-the-function-tp3163361p3163853.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] selection of outputs from the function

2010-12-24 Thread ufuk beyaztas

Hi Dear All,
This is a function which contains Covariance Ratio and Likelihood Distance
values (CVRi, LDi). i want to compute the all row's values, that is run this
function for nrow(X) times. The X and Y matrices are;

X-matrix(c(1125,920,835,1000,1150,990,840,650,640,583,570,570,510,555,460,275,510,165,244,79,232,268,271,237,192,202,184,200,180,165,151,171,243,147,286,198,196,210,327,334,7160,8804,8108,6370,6441,5154,5896,5336,5041,5012,4825,4391,4320,3709,3969,3558,4361,3301,2964,2777,85.9,86.5,85.2,83.8,82.1,79.2,81.2,80.6,78.4,79.3,78.7,78.0,72.3,74.9,74.4,72.5,57.7,71.8,72.5,71.9,8905,7388,5348,8056,6960,5690,6932,5400,3177,4461,3901,5002,4665,4642,4840,4479,4200,3410,3360,2599),nrow=20)
Y-matrix(c(1.5563,0.8976,0.7482,0.7160,0.3130,0.3617,0.1139,0.1139,-0.2218,-0.1549,0.,0.,-0.0969,-0.2218,-0.3979,-0.1549,-0.2218,-0.3979,-0.5229,-0.0458),nrow=20)

theta - function(X,Y) {
B.cap - solve(t(X)%*%X)%*%t(X)%*%Y
P - X%*%solve(t(X)%*%X)%*%t(X)
Y.cap - P%*%Y
e - Y-Y.cap
var.cap-(t(e)%*%e)/(nrow(X)-ncol(X)-1)
ei - Y[i,]-X[i,]%*%B.cap
pi - P[i,i]
var.cap.i -
(((nrow(X)-ncol(X)-1)*var.cap)/(nrow(X)-ncol(X)-2))-(ei^2/((nrow(X)-ncol(X)-2)*(1-pi)))
ti - ei/(sqrt(var.cap)*sqrt(1-pi))
ti.star - ei/(sqrt(var.cap.i)*sqrt(1-pi))

X.star - cbind(X,Y)
pi.star - pi+(ei^2/(t(e)%*%e))


LDi -  nrow(X)*log(((nrow(X))/(nrow(X)-1))*(((nrow(X)-ncol(X)-2))/
(ti.star^2+nrow(X)-ncol(X)-2)))+((ti.star^2*(nrow(X)-1))/((1-pi)*(nrow(X)-ncol(X)-2)))-1
CVRi - (((nrow(X)-ncol(X)-1-ti^2)/(nrow(X)-ncol(X)-2))^(nrow(X)))/(1-pi)

list(ti=ti,ti.star=ti.star,pi=pi,pi.star=pi.star,LDi=LDi,CVRi=CVRi) }

obj-list()
for(i in 1:nrow(X)){
X-X
Y-Y
out-theta(X,Y)
obj-c(obj,list(out))}
obj

Finally i get values...
Is there any way to get the outputs as a list or data.frame like
pi CVRi
1   11
2   22
3   33
4   44
5   55
6   66
7   77
8   88
9   99
10 10   10
11 11   11
12 12   12
13 13   13
14 14   14
15 15   15
16 16   16
17 17   17
18 18   18
19 19   19
20 20   20
for all values (pi,pi.star,ti,ti.star,CVRi,LDi)... 
Thanks so much for any idea !
-- 
View this message in context: 
http://r.789695.n4.nabble.com/selection-of-outputs-from-the-function-tp3163361p3163361.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] selection of outputs from the function

2010-12-24 Thread ufuk beyaztas

Thank so much David !
-- 
View this message in context: 
http://r.789695.n4.nabble.com/selection-of-outputs-from-the-function-tp3163361p3163421.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] regression

2010-12-22 Thread ufuk beyaztas

Hi dear all,

suppose that s is a statistic code;

i have a matrix (x) which has 7 columns (1=x1,2=x23=x3,4=x4,5=x5,6=x6
and7=y)
and has 20 rows. i want to do linear reggression like 
reg-lm(x[,7]~1+x[,1]+x[,2]+...+x[,6])
but i want to do delete i th row for nrows times and create regression model
like above and compute each models'   s statistics and list them. but i
could not do. i always get only one model and statistic. 
How can i do this

Thanks any idea!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/regression-tp3161328p3161328.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regression

2010-12-22 Thread ufuk beyaztas

Thank you so much i did with your idea..
thank you :)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/regression-tp3161328p3161524.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regression

2010-12-22 Thread ufuk beyaztas

sorry not read i want to say write
-- 
View this message in context: 
http://r.789695.n4.nabble.com/regression-tp3161328p3161551.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regression

2010-12-22 Thread ufuk beyaztas

thank you so much, and i have a question too
if i read some statistic for example cook-weisberg statistic or welsh-kuh
distance and i say 
stat-welsh.kuh than i put this statistic in your idea, can i get the
statistics each times?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/regression-tp3161328p3161549.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] delete-d jackknife

2010-11-25 Thread ufuk beyaztas

Thank you so much :)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/delete-d-jackknife-tp3058335p3059364.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] delete-d jackknife

2010-11-24 Thread ufuk beyaztas

Hi dear all,
Can aynone help me about delete-d jackknife
usually normal jackknife code for my data is:
n - nrow(data)
y - data$y
z - data$z
theta.hat - mean(y) / mean(z)
print (theta.hat)

theta.jack - numeric(n)
for (i in 1:n)
theta.jack[i] - mean(y[-i]) / mean(z[-i])
bias - (n - 1) * (mean(theta.jack) - theta.hat)

print(bias)

but how i can apply delete-d jackknife when d=2 or 3.  
Thanks forany idea..
-- 
View this message in context: 
http://r.789695.n4.nabble.com/delete-d-jackknife-tp3058335p3058335.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Counting

2010-11-16 Thread ufuk beyaztas

Hi dear all,

i have a data (data.frame) which contain y and x coloumn(i.e. 

 y   x
1   0.58545723  0.15113102
2   0.02769361 -0.02172165
3   1.00927527 -1.80072610
4   0.56504053 -1.12236685
5   0.58332337 -1.24263981
6  -1.70257274  0.46238255
7  -0.88501561  0.89484429
8   1.14466282  0.34193875
9   0.58827457  0.15923694
10 -0.79532232 -1.44193770)

i changed the first data points by an outlier (i.e.

y  x
1  1025
2   0.02769361 -0.02172165
3   1.00927527 -1.80072610
4   0.56504053 -1.12236685
5   0.58332337 -1.24263981
6  -1.70257274  0.46238255
7  -0.88501561  0.89484429
8   1.14466282  0.34193875
9   0.58827457  0.15923694
10 -0.79532232 -1.44193770  )

then i generate the 1000 bootstrap sample with this data set, some of them
not contain these outliers, some of them contain once and some of them
contain many time... Now i want to count how many samples not contain these
outliers. 
Thank so much any idea!


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Counting-tp3045756p3045756.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Counting

2010-11-16 Thread ufuk beyaztas

thank you very much for your idea,
if i write code as;
my data name is data.

samples-function(data,num){
resamples-lapply(1:num,function(i) sample(data,n,replace=TRUE))
list(resamples=resamples)}

n=10
data-rnorm(n=10,mean=5,sd=2)
data[1]=100
obj-samples(data,1000)

i generate 1000 sample, i did not use 'boot'.  100 is a outlier in the data
set and same stuation, some of samples not contain , some of samples contain
once and some of them contain many times. Now can you tell me how i count
how many samples are there not contain any outlier in the 1000 samples?


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Counting-tp3045756p3045842.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Counting

2010-11-16 Thread ufuk beyaztas

Thank you so much
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Counting-tp3045756p3045918.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Counting

2010-11-16 Thread ufuk beyaztas

Thank you so much
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Counting-tp3045756p3045917.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] jackknife-after-bootstrap

2010-11-15 Thread ufuk beyaztas

I am always trying but i could not do it. Are there any example about this
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Re-jackknife-after-bootstrap-tp3043213p3043398.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.