Re: [R] Graphic Device - View/get all graphics

2009-11-27 Thread MarcioRibeiro

Hello,
After some research, I didn't resolve my doubt yet...
Maybe I didn't explain very well my question... So, I have a bootstrap
simulation, but suppose just a simple part of my function:

teste -function(x){
rw_mean_app-rnorm(x, mean = 10, sd = 2)
rwy_mean_app-rnorm(x, mean = 10, sd = 2)
rw_median_app_ori-rnorm(x, mean = 10, sd = 2)
rw_median_app_mod-rnorm(x, mean = 10, sd = 2)

histogram-par(mfrow=c(1,2),ask=TRUE)
hist(rw_mean_app,main='Method RWOriginal',xlab='Mean',ylab=' ')
hist(rwy_mean_app,main='Method RWY',xlab='Mean',ylab=' ')
par(histogram)

histogram-par(mfrow=c(1,2) ,ask=TRUE)
hist(rw_median_app_ori,main='Method RWOriginal',xlab='Median',ylab=' ')
hist(rw_median_app_mod,main='Method RWModified',xlab='Median',ylab=' ')
par(histogram)

}   #END OF FUNCTION
GRAF-teste(100)

I cannot save rnorm objects in a list cause they are distribution from 1000
simulation... So, I would like to produce the graphics in my function and
find out a way that I could save the graphics... I can save the object using
the LIST procedure, but I dont know how I save an object that is a
graphic...
Listers, I just want some advices in order to make a research about what
functions of R I could save the graphics in my function...
Thanks again,
Marcio




MarcioRibeiro wrote:
 
 Hi Listers,
 I am producing some graphics that the commands are in a FUNCTION...
 The problem is that I end up viewing just last graphic and in my FUNCTION
 there are 4 graphics with the PAR command function... Like those below...
 How do I view/get the other 3 graphics? Any help?
 Thanks in advance...
 
 histogram-par(mfrow=c(1,2))
 hist(rw_mean_app,main='Bootstrap Method RWOriginal',xlab='Mean',ylab=' ')
 hist(rwy_mean_app,main='Bootstrap Method RWY',xlab='Mean',ylab=' ')
 par(histogram)
 
 histogram-par(mfrow=c(1,3))
 hist(rw_median_app_ori,main='Bootstrap Method
 RWOriginal',xlab='Median',ylab=' ')
 hist(rw_median_app_mod,main='Bootstrap Method
 RWModified',xlab='Median',ylab=' ')
 hist(rwy_median_app,main='Bootstrap Method RWY',xlab='Median',ylab=' ')
 par(histogram)
 
 

-- 
View this message in context: 
http://old.nabble.com/Graphic-Device---View-get-all-graphics-tp26498560p26545221.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] Graphic Device - View/get all graphics

2009-11-24 Thread MarcioRibeiro

Hi Listers,
I am producing some graphics that the commands are in a FUNCTION...
The problem is that I end up viewing just last graphic and in my FUNCTION
there are 4 graphics with the PAR command function... Like those below...
How do I view/get the other 3 graphics? Any help?
Thanks in advance...

histogram-par(mfrow=c(1,2))
hist(rw_mean_app,main='Bootstrap Method RWOriginal',xlab='Mean',ylab=' ')
hist(rwy_mean_app,main='Bootstrap Method RWY',xlab='Mean',ylab=' ')
par(histogram)

histogram-par(mfrow=c(1,3))
hist(rw_median_app_ori,main='Bootstrap Method
RWOriginal',xlab='Median',ylab=' ')
hist(rw_median_app_mod,main='Bootstrap Method
RWModified',xlab='Median',ylab=' ')
hist(rwy_median_app,main='Bootstrap Method RWY',xlab='Median',ylab=' ')
par(histogram)

-- 
View this message in context: 
http://old.nabble.com/Graphic-Device---View-get-all-graphics-tp26498560p26498560.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] Sum according observation

2009-09-18 Thread MarcioRibeiro

Hi listers,
I have a simple doubt...
I need to manipulate the data base as:

var1 var2
7  0.1
7  0.1
8  0.12
100.15
120.18
200.31

I would like to aggregate the equal cases as var1 making the sum of var2...
I would get...

var1 var2
7  0.2
8  0.12
100.15
120.18
200.31

Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Sum-according-observation-tp25510566p25510566.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] Program with indicatrix function

2009-09-17 Thread MarcioRibeiro

Hi listers,
First I programmed the calcul of a empirical distribution function given by:

F_hat(y)=(1/n)*Sum[Ind(yi=y)]

I checked the ecdf function and I found out how does it works...
A modification of the function would be:
n-6
x-c(10,12,7,7,5,4)
vals-unique(x)
edf-cumsum(tabulate(match(x, vals)))/n
But, what I am really looking for is this:

P_hat(y)=Sum[Ind(yiy)]

At this case my indicatrix function has no equality...
So, I was tryind to program with IF and ELSE...
But it seems kind of complicated...
Could anybody give me any clue, like the algorithm idea...
Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Program-with-indicatrix-function-tp25501538p25501538.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] Bootstrap simulation

2009-09-10 Thread MarcioRibeiro

Hi listers,
I would like a suggestion. I am working on a bootstrap simulation which I am
calculation the confidence intervals to obtain the coverage probability. I
am applying 3 kind of confidence intervals and 3 coverage probabilities (2
sided, left 5% and left 95%).
I programmed a function for that, but my function is getting to long,
because I am calculating many statistics (mean, median, quantile...). So,
for each statistic I have 9 comands to obtain my results, so for 3
statistics I will get 27 comands... I am searching for a optimal way to
reduce the quantity of formulas... Is that clear... Any suggestions...
BThanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/Bootstrap-simulation-tp25390390p25390390.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] Simulation function

2009-08-18 Thread MarcioRibeiro

Hi listers,
I've been looking for a procedure, but I am not succeding...
I have a function that give multiple results...
Then, I would like to simulate this function n times, so I need to save/keep
the n multiple results, in order to calculate my desired statistics...
I have already tried with the RETURN and LIST FUNCTION, but I am not getting
it right...
An example of what I am looking for sounds like this...

boot-function(a,b,c){
media-(a+b+c)/3
var_app-var(a)
list(media=media,var_app=var_app)
}
boot(2,4,10)

simul-function(S){
results-rep(0,S)
for(i in 1:S){
results[i]-boot(2,4,10)
}
var-var(media)
mean_var-mean(var_app)
var_var-var(var_app)
list(var=var,mean_var=mean_var,var_var=var_var)
}
simul(5)

-- 
View this message in context: 
http://www.nabble.com/Simulation-function-tp25027993p25027993.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] Simulation Function - Save results

2009-08-14 Thread MarcioRibeiro

Hi listers,
I am working on a simulation... But I am having some troubles...
Suppose I have a function A which produces two results (mean and
variance)...
Then I would like to simulate this function A with a function B many times
using the results from function A
For example:

#Function A
boot-function(a,b,c){
mean_boot-(a+b)/2
var_boot-c
#list(a=a,b=b,c=c)
return(a)
}

Then I would like to create 2 vectors with the mean and var results from S
simulations

#Function B
simul-function(S){
teste-rep(0,S)
for(i in 1:S){
teste[i]-boot(10,12,15)  #ACCORDING TO FUNCTION A I AM SAVING JUST THE
MEAN_BOOT, BUT I ALSO NEED THE RESULT OF VAR_BOOT
}
var-var(teste)
mean_emp-mean(var_boot) #THIS IS NOT WORKING, BECAUSE I DONT HAVE THE
VAR_BOOT AT MY VECTOR
var_emp-(sum((var_boot-var)**2))/S #THIS IS NOT WORKING, BECAUSE I DONT
HAVE THE VAR_BOOT AT MY VECTOR
}
simul(5)

But my problem is that I don't know how to save my results in 2 vectors in
order to use then at function B.
Thanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/Simulation-Function---Save-results-tp24977851p24977851.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] Merge vectors

2009-07-22 Thread MarcioRibeiro

Hi listers,
I would like to merge two vectors as follows...
A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)
I would like to set the vector of random numbers according to the order set
of the vector of data values...
The result would be: (130,43,43,130,98,230,5,91,7,230,130)
I could do this with merging, but I would need to set a primary key to merge
the vectors... Is there a way of doing directly...
Thanks in advance,
Marcio


-- 
View this message in context: 
http://www.nabble.com/Merge-vectors-tp24612997p24612997.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] Select value according two vectors...

2009-07-21 Thread MarcioRibeiro

Hi listers,
I have a problem in identifying a value between two vectors...
Suppose vector A is...
0. 0.0909 0.0909 0.1818 0.2727 0.3636 0.4545 0.6363 0. 0. 0.
0.
And vector B is...
3   5   7  18  43  85  91  98 100 130 230 487
I would like to identify the value of vector B that vector A is bigger than
0.5, this means that I want to identify the 9-th value of vector B, that is
98.
I know how to do that if I had the both vectors as a matrix, but I want to
do this procedure with two vectors... 
Any suggestions...
Thanks in advance,
Marcio



-- 
View this message in context: 
http://www.nabble.com/Select-value-according-two-vectors...-tp24589588p24589588.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] Sample Function

2009-07-16 Thread MarcioRibeiro

Hi listers,
I am 
-- 
View this message in context: 
http://www.nabble.com/Sample-Function-tp24519071p24519071.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] Sample Function

2009-07-16 Thread MarcioRibeiro

Hi listers,
Suppose I have a dataset with n=10 observations and I want to sample with
replacement.
My new sample is of size m=9.
So, I am using the following code...
newsample-dataset[sample(m,replace=T),]
The problem is that generates the new sample and the last observation of my
data set is never included.
I can sample the identification like this code...
newsample-sample(1:n,m,replace=TRUE)
But, after this code I am obtaining a statistic and I have only the
identification of the data observed.
Is there a way that I can sample the data observed to calculate a statistic
of it.
Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Sample-Function-tp24519230p24519230.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] Order data frame

2009-06-12 Thread MarcioRibeiro

Hi listers,
I have a data frame with 5 variables... And I want reorder the data frame
according a specific variable X...
I checked the sort and order functions... In my case I think that the ORDER
function is applicable... But I did not understand at all... The idea is
simple... Data order by X...
I know that this is very simple... Anyways... How I would do that...
Thanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/Order-data-frame-tp24004394p24004394.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] Count observation

2009-06-11 Thread MarcioRibeiro

Hi listers,
I have the following code...

data-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE)
n-nrow(data)
m-n-1
boot-data[sample(m,replace=T),]

So, I need to count the number of times each observation was selected at the
sample with replacement...
Suppose I sampled...
4 5 1 3 7 5 1 4 7

So, I would count...
x  count
1  2
2  0
3  1
4  2
5  2
6  0
7  2
8  0
9  0
10 0

Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Count-observation-tp23987251p23987251.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] Count observation

2009-06-11 Thread MarcioRibeiro

Hey... Milton...
Is that a equation... Brazil=Toronto
If so, mine is... Brazil=Montreal
You got it...
I am not having a good time with R... There is no help for data manipulation
at all...
Thanks for the help... 
Marcio



milton ruser wrote:
 
 Hi Marcio,
 
 data.frame(table(boot))
 ?
 
 milton
 brazil=toronto
 On Thu, Jun 11, 2009 at 3:13 PM, MarcioRibeiro mes...@pop.com.br wrote:
 

 Hi listers,
 I have the following code...

 data-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE)
 n-nrow(data)
 m-n-1
 boot-data[sample(m,replace=T),]

 So, I need to count the number of times each observation was selected at
 the
 sample with replacement...
 Suppose I sampled...
 4 5 1 3 7 5 1 4 7

 So, I would count...
 x  count
 1  2
 2  0
 3  1
 4  2
 5  2
 6  0
 7  2
 8  0
 9  0
 10 0

 Thanks in advance,
 Marcio
 --
 View this message in context:
 http://www.nabble.com/Count-observation-tp23987251p23987251.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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
   [[alternative HTML version deleted]]
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Count-observation-tp23987251p23988982.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] Discriminant Analysis Ellipse

2009-04-10 Thread MarcioRibeiro

Hi listers,
I am working on a program in order to create an ellipse as a limit of my
observations there are well classified.
I have two independent variables for an quadratic discriminant function
between 2 groups where my mean is zero and my covariance matrix is
proportional.
Q=y'Ay+c
My program follows below with unreal data... My ellipse it's not surrounding
the correct number of classified observations... I am getting more
misclassification than I should...

ellipse-function(mu,sigma){
p-2
priori1-.55
priori2-.45
gamma-3
spectral-eigen(sigma,symmetric=T)
value-spectral$values
vector-spectral$vectors
angle-seq(0,2*pi,length=100)
c-log(priori1/priori2)+(p/2)*log(gamma) #gamma=proportional constant
y-c*rbind(sqrt(value[1])*cos(angle),sqrt(value[2])*sin(angle))
t(mu+(vector%*%y))
}
mu=c(0,0)
sigma=matrix(c(6,2,2,7),nrow=2,ncol=2,byrow=TRUE)
x=ellipse(mu,sigma)
par(pty=s)
plot(x[,1],x[,2],xlab=y1,ylab=y2,type=l,main=Graphic,xlim=c(-10,10),ylim=c(-10,10))
data-cbind(c(1,2,4,6),c(1,3,5,4))
points(data[,1],data[,2],pch=+)

Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Discriminant-Analysis-Ellipse-tp22978984p22978984.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] Discriminant analysis - posterior prob

2009-04-04 Thread MarcioRibeiro

Hi listers,
I have a statistical question corcerning the posteriori probability of a
discriminant analysis.
I am calculating the probabilities under R using the formula.
posteriori_j=exp(q_j(y))/sum(q_j(y))
qj(y) is my quadratic discriminant function for the case where my covariance
matrix are proportional with y=(y1,y2) et j=1,2 groups
My doubt is how I could calculate this ratio when my dimension (number of
observations) is different for each j group.
Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Discriminant-analysis---posterior-prob-tp22874222p22874222.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] Matrix multiplication - code problem

2009-04-02 Thread MarcioRibeiro

Hi again,
I understood what you guys explained...
But, there isn't a way to do a multiplication of matrix with a FOR command
or otherelse where one o my dimension is ONE...
Well, as my data file is small, I did the procedure at the excel... But,
this is not the good procedure...
Thanks,
Marcio


Uwe Ligges-3 wrote:
 
 
 
 MarcioRibeiro wrote:
 Hi listers,
 I am having some trouble in a matrix multiplication...
 I have already checked some posts, but I didn't find my problem...
 I have the following code...
 But I am not getting the right multiplication...
 I checked the dimension and they are fine...
 
 id_y - array(1:10,dim=c(2,1,5))
 id_yt-aperm(id_y,c(2,1,3))
 m_id-array(dim=c(dim(id_y)[1],dim(id_y)[1],dim(id_y)[3]))
 for (i in 1:dim(id_y)[3]){
 m_id[,,i]-id_y[,,i]%*%id_yt[,,i]
 }
 m_id
 
 
 
 
 Due to indexing, you are loosing dimensions.
 The problem is that you expect to *loose exactly one* dimension in this 
 case (hence drop = FALSE won't be of help right away). Hence it might be 
 a good idea to know what you are going to have exactly at the end (as 
 in- and output).
 
 Uwe Ligges
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Matrix-multiplication---code-problem-tp22835003p22850519.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] Matrix multiplication - code problem

2009-04-01 Thread MarcioRibeiro

Hi listers,
I am having some trouble in a matrix multiplication...
I have already checked some posts, but I didn't find my problem...
I have the following code...
But I am not getting the right multiplication...
I checked the dimension and they are fine...

id_y - array(1:10,dim=c(2,1,5))
id_yt-aperm(id_y,c(2,1,3))
m_id-array(dim=c(dim(id_y)[1],dim(id_y)[1],dim(id_y)[3]))
for (i in 1:dim(id_y)[3]){
m_id[,,i]-id_y[,,i]%*%id_yt[,,i]
}
m_id


-- 
View this message in context: 
http://www.nabble.com/Matrix-multiplication---code-problem-tp22835003p22835003.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] Matrix multiplication - code problem

2009-04-01 Thread MarcioRibeiro

Hi again...
I will get an array with 5 matrix 2x2, with dimension 2x2x5
This code below works fine... And I am applying the same procedure...
The problem might be when I do the permutation of the array, but I checked
the dimension and its all right...

array1 - array(1:30,dim=c(3,2,5))
array2 - array(1:20,dim=c(2,2,5))
result - array(dim=c(dim(array1)[1], dim(array2)[2], dim(array1)[3]))
for (i in 1: dim(array1)[3]){
result[,,i] - array1[,,i]%*%array2[,,i] 
}

Thanks...


Ben Bolker wrote:
 
 
 
 MarcioRibeiro wrote:
 
 Hi listers,
 I am having some trouble in a matrix multiplication...
 I have already checked some posts, but I didn't find my problem...
 I have the following code...
 But I am not getting the right multiplication...
 I checked the dimension and they are fine...
 
 id_y - array(1:10,dim=c(2,1,5))
 id_yt-aperm(id_y,c(2,1,3))
 m_id-array(dim=c(dim(id_y)[1],dim(id_y)[1],dim(id_y)[3]))
 for (i in 1:dim(id_y)[3]){
 m_id[,,i]-id_y[,,i]%*%id_yt[,,i]
 }
 m_id
 
 
 
 What did you expect to happen?
 
   Ben Bolker
 
 

-- 
View this message in context: 
http://www.nabble.com/Matrix-multiplication---code-problem-tp22835003p22836042.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] Package candisc

2009-03-31 Thread MarcioRibeiro

Hi listers,
I am working on an canonical discriminant analysis, but I am having some
trouble to use the CANDISC function... I just installed the last R version
and installed the package CANDISC... But, I am getting the following message
because about a permission:

The downloaded packages are in
C:\Users\Marcio\AppData\Local\Temp\Rtmpz2kFUm\downloaded_packages
updating HTML package descriptions
Warning message:
In file.create(f.tg) :
cannot create file 'C:\PROGRA~1\R\R-28~1.1/doc/html/packages.html', reason
'Permission denied'
 
Could anybody tell me if I am forgeting about something in order to use the
CANDISC function!
Thanks in advance,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Package-candisc-tp22797571p22797571.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] Data manipulation - multiplicate cases

2009-03-27 Thread MarcioRibeiro

Hi listers,
I am trying to arrange my data and I didn't find any information how to do
it!
I have a data with 3 variables: X Y Z
1-I would like to multiplicate de information of X according to the number I
have for my Y variable...
2-Then I want to identify with a dicotomic variable by the number according
my variable Z from X...
I can do the first part by...
z-rep(x,y)
But I don't know how to set a dicotomic variable according to Z...
Exemple...
I have...
X  YZ
123   31
234   31
345   42
456   32
I want to get...
X  YZ
123   31
123   30
123   30
234   31
234   30
234   30
345   41
345   41
345   40
345   40
456   31
456   31
456   30

Thanks in advance...
-- 
View this message in context: 
http://www.nabble.com/Data-manipulation---multiplicate-cases-tp22730453p22730453.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] Quadratic Discriminant Analysis (qda)

2009-03-27 Thread MarcioRibeiro

Hi listers,
Does anybody knows if the function qda for quadratic discriminant analysis
provides the coefficients of quadratic discriminants...
Well, I find out that for the linear discriminant analysis lda, the fonction
provides the coefficients...
Thanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/Quadratic-Discriminant-Analysis-%28qda%29-tp22747647p22747647.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] Hotteling Test

2009-03-24 Thread MarcioRibeiro

Hi listers,
I would like to do a graphic of the power function of the Hotteling test
(T2).
T2~F(p,n-p;lambda), lambda is my paremeter of non-centrality.
So I would like to do a graphic of the power of the test as a function of
the parameter lambda. I also would like to define lambda varying between
0.05 and 1.
I am really not sure if the way that I am doing the graphic is the best
methodology.
I am working on this code...
N-20
p-3
alpha-0.05
mean0-matrix(c(0,0,0),nrow=3,ncol=1,byrow=TRUE)
mean1-matrix(c(0,1,0),nrow=3,ncol=1,byrow=TRUE)
sigma-matrix(c(1,0.2,-0.8,0.2,1,0.4,-0.8,0.4,1),nrow=3,ncol=3,byrow=TRUE)
T2-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))
lambda-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))/2
critique-qf(1-alpha,3,17)#critique ~ Fp,n-p(α)
beta-1-pf(critique,p,n-p,ncp=lambda)
beta

beta1-c(rep(0,112))
lambda1-c(1:112)
for (i in 1:112){
beta1[i]-1-pf(critique,p,N-p,ncp=lambda1[i])
}
if (0.05beta11){
plot(beta1,pch=.)
}

Thanks,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Hotteling-Test-tp22682412p22682412.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] Distribution U

2009-03-17 Thread MarcioRibeiro

Hi listers,
Does anybody could tell me if there is a function for the DISTRIBUTION
FUNCTION U(p;m,n)!
Thanks,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Distribution-U-tp22567871p22567871.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] While with 2 conditions

2009-02-27 Thread MarcioRibeiro

Hi listers,
I check it out at the messages... But I didn't find how do I use the while
with 2 conditions...
while (a1 ? b1){
a-2
b-2
}
Should I use what...
Thanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/While-with-2-conditions-tp22252945p22252945.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] ML estimators of bivariate cauchy

2009-02-20 Thread MarcioRibeiro

Hi all,
I am using the function COV.WT to estimate the estimators (location and
scale) of a bivariate cauchy distribution.
My doubt is about the option WT (weight), cause at the R-help shows that the
weight is uniform according to the number of observations. But, checking the
theory, for example, the mean is given by
mean_estimator=mean(u(s)x)/mean(u(s)), where
x=my data (bivariate)
u(s)=(df+p/df+s), df=degree freedom, p=number parameters, s=mahalanobis
distance
The u(s) function is considered as a weight, in which gives more weight for
the observations with a small mahalanobis distance.
My question is, should I use this function u(s) as my weigth option at the
COV.WT function.
Is that clear!
Thanks in advance,
Marc
-- 
View this message in context: 
http://www.nabble.com/ML-estimators-of-bivariate-cauchy-tp22124857p22124857.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] Matrix multiplication multivariate

2009-02-20 Thread MarcioRibeiro

Hi listers...
I am trying to do a matrix multiplication...
Suppose my data has 100 obs and 2 variables...
I calculated the estimateurs of location and dispersion...
So now I would like to do the following...
t(Xi-location)%*%solve(dispersion)%*%(Xi-location)
My code is...
Z-rep(2,200)
Z-matrix(Z,nrow=100,ncol=2,byrow=TRUE)
p-ncol(Z)
N-nrow(Z)
poids-rep(1/N,N)
results-cov.wt(Z, wt=poids, method=ML)
loc-t(as.matrix(results$center))
disp-as.matrix(results$cov)
loc1-rep(2.678117,100)#SUPPOSE THAT THE LOCATION HAS THIS VALUE...
loc2-rep(4.824589,100)#EVEN THAT I STILL NEED TO FIND OUT TO DO THIS PART
MORE EFFICIENTLY...
loc-cbind(loc1,loc2)

niter-100
x1-rep(0,niter)
x2-rep(0,niter)
for (i in 1:niter){
x1[i]-(Z[i,1]-loc[i,1])
x2[i]-(Z[i,2]-loc[i,2])
}
x-cbind(x1,x2)

So, I calculated (Xi-location=xi)
But now I am having a hard time to calculate
(t(xi)%*%solve(dispersion)%*%(xi))
I am trying something like this...

for (i in 1:niter){
w[i]-t(x[i,])%*%idisp%*%(x[i,])
}

But there is something wrong with the dimensions... I am continuing to find
out a way...
But appreciate any suggestions!
Thanks in advance,
Marcio

-- 
View this message in context: 
http://www.nabble.com/Matrix-multiplication-multivariate-tp22130812p22130812.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.