random.general.test(rportfolios)
random.general.test()所属R语言包:rportfolios
Random general portfolio
随机一般组合
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function generates a general random portfolio of n investments with k long and short positions. The probability that a non-zero investment weight is positive is p. The maximum absolute exposure for any investment is x.u. The default value is 1 / k. The function is used to evaluate the performance of the portfolio generation algorithm.
这个函数产生随机的n投资组合与k多头和空头头寸。一个非零的投资重量为正的概率是p。任何投资的最大绝对曝光许默认值是1 / K。使用该函数的组合生成算法的性能进行评估。
用法----------Usage----------
random.general.test(n = 2, k = n, p = 0.5, x.u = 1/k)
参数----------Arguments----------
参数:n
A positive integer value for the number of investments in the portfolio
投资组合中的一个正整数的值
参数:k
A positive integer value for the number of non-zero positions
非零位置的数目的一个正整数的值
参数:p
A positive numeric value for the probability that an investment weight is positive
一个正数的投资权重值的概率是积极的
参数:x.u
A positive numeric value for the maximum absolute exposure to an investment
正数值的最大绝对的投资风险
Details
详细信息----------Details----------
If k < n the function random.general.test is recursively called with n set equal to k to obtain a k \times 1 vector of non-zero long and short weights. The R function sample is used to generate a simple random sample without replacement of k values from the integers 1,2, … ,n. These are the subscripts into an n \times 1 zero vector to assign the k non-zero weights. This vector is returned.
如果 k < n的功能random.general.test被递归调用n设定长度等于k,得到k \times 1非零的长和短的权重向量。 R的功能sample没有更换的整数1,2, … ,nk值是用来生成一个简单的随机抽样。这些是成n \times 1零矢量分配的k非零重量的下标。该向量被返回。
If k = n , the R function rbinom is used to generate a vector of plus and minus ones corresponding to the long and short positions. The R function runif is used to generate uniformly distributed values between 0 and 1. These are scaled by x.u and then multiplied by the signs. The sum of the investment weights is not restricted.
如果 k = n ,R函数rbinom是用来产生相应的多头和空头头寸的加号和减号的一个向量。 R函数runif是用来产生均匀分布的值在0和1之间。这些比例由徐,然后乘以迹象。的投资权重的总和是没有限制。
值----------Value----------
A list with two named components.
列表与两个命名的部分。
参数:x
An n \times 1 numerical vector of investment weights
数值的投资权重向量n \times 1
参数:iter
An integer value for the number of iterations used to obtain the investment weights
一个整数值,用于以获得的投资权重的数目的迭代
(作者)----------Author(s)----------
Frederick Novomestky <a href="mailto:fnovomes@poly.edu">fnovomes@poly.edu</a>
实例----------Examples----------
###[##]
### long only portfolio of 30 investments with 30 non-zero positions[##30投资组合与30个非零位]
###[##]
result.x.long <- random.general.test( 30, p=1.0 )
###[##]
### long only portfolio of 30 investments with 10 non-zero positions[##30投资组合与10个非零位]
###[##]
result.y.long <- random.general.test( 30, 10, p=1.0 )
###[##]
### short only portfolio of 30 investments with 30 non-zero positions[##短的只有30投资组合与30个非零位]
###[##]
result.x.short <- random.general.test( 30, p=0.0 )
###[##]
### short only portfolio of 30 investments with 10 non-zero positions[##短的只有30投资组合与10个非零位]
###[##]
result.y.short <- random.general.test( 30,10, p=0.0 )
###[##]
### long short portfolio of 30 investments with 30 non-zero positions[##30投资组合的长的短的30个非零位]
###[##]
result.x.long.short <- random.general.test( 30, p=0.5 )
###[##]
### long short portfolio of 30 investments with 10 non-zero positions[##30投资组合的长的短的10个非零位]
###[##]
result.y.long.short <- random.general.test( 30, 10, p=0.5 )
###[##]
### long bias portfolio of 30 investments with 30 non-zero positions[##长投资的30个与30个非零位偏差投资组合]
###[##]
result.x.long.bias <- random.general.test( 30, p=0.7 )
###[##]
### long bias portfolio of 30 investments with 10 non-zero positions[##长投资的30个与10个非零位偏差投资组合]
###[##]
result.y.long.bias <- random.general.test( 30, 10, p=0.7 )
###[##]
### short bias portfolio of 30 investments with 30 non-zero positions[##短的偏压组合投资的30个与30个非零位]
###[##]
result.x.short.bias <- random.general.test( 30, p=0.3 )
###[##]
### short bias portfolio of 30 investments with 10 non-zero positions[##短的偏压组合投资的30个与10个非零位]
###[##]
result.y.short.bias <- random.general.test( 30, 10, p=0.3 )
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|