Hi Team,
I am new to using apply function in R.
I want to find out the empirical quantiles of all items in a list.


## Fitting Kernal Density function
Emp_Marginals<-apply(M_Diff_Final,2,kde)
### Simulated variables
Sim_Cop<-abs(rmvnorm(10000,mean=apply(M_Diff_Final,2,mean),sigma=cov(M_Diff_Final),method="chol"))
####Now I am trying to use mapply but no help

# Sim_Quantiles<-matrix(mapply(qkde,Sim_Cop,fhat=Emp_Marginals,SIMPLIFY = 
F),nrow=10,byrow=T)
#### Matrix Def

Sim_Quantiles<-matrix(0,nrow=nrow(Sim_Cop),ncol=ncol(Sim_Cop))

### The following code works but I want to avoid using for loops
for (j in 1:ncol(Sim_Quantiles)){
    for (i in 1:nrow(Sim_Cop)){
   Sim_Quantiles[i,j]<-qkde(Sim_Cop[i,j],Emp_Marginals[[j]])
    }
  }

Thanks and Regards,
Gaurang Mehta

This email is intended for the person or company named and access by anyone 
else is unauthorised. If you are not the person or company named, please delete 
this email and notify the sender.

The information in this email, including any attachments, may be confidential 
or legally privileged (meaning that its disclosure is protected in law). Its 
unauthorised disclosure, copying, distribution or use is prohibited and may be 
unlawful.

Email communications sent over the internet are not guaranteed to be secure or 
virus-free and such messages are potentially at risk.  The Royal London Group 
accepts no liability for any claims arising from use of the internet to 
transmit messages by or to any company within the Royal London Group.

The Royal London Group consists of The Royal London Mutual Insurance Society 
Limited and its subsidiaries.

The Royal London Mutual Insurance Society Limited is authorised by the 
Prudential Regulation Authority and regulated by the Financial Conduct 
Authority and the Prudential Regulation Authority and provides life assurance 
and pensions.

Registered in England and Wales number 99064.

Registered office: 55 Gracechurch Street, London, EC3V 0RL.

In the Republic of Ireland: The Royal London Mutual Insurance Society Limited 
is authorised by the Prudential Regulation Authority in the UK and is regulated 
by the Central Bank of Ireland for conduct of business rules.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to