[Blotter-commits] r762 - in pkg/quantstrat: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Sep 8 14:32:02 CEST 2011
Author: braverock
Date: 2011-09-08 14:32:01 +0200 (Thu, 08 Sep 2011)
New Revision: 762
Modified:
pkg/quantstrat/R/parameters.R
pkg/quantstrat/man/setParameterConstraint.Rd
pkg/quantstrat/man/setParameterDistribution.Rd
Log:
- fix syntax error
Modified: pkg/quantstrat/R/parameters.R
===================================================================
--- pkg/quantstrat/R/parameters.R 2011-09-07 20:00:43 UTC (rev 761)
+++ pkg/quantstrat/R/parameters.R 2011-09-08 12:32:01 UTC (rev 762)
@@ -742,13 +742,13 @@
#' @examples
#' #(For complete demo see parameterTestMACD.R)
#' #In a MACD strategy, we want to fast macd calcuated from less time periods (days)
-#' than slow macd signal:
+#' #than slow macd signal:
#' \dontrun{
#' x<-setParameterConstraint(constraintLabel='macdPC',
#' paramList=c('nFast','nSlow'),relationship='lt')
#' }
#' #The object x then can be used as one of the inputs to applyParameter function to specify the
-#' constraints between parameters.
+#' #constraints between parameters.
#'
#' @param paramConstraintObj the ParameterConstraint object to be updated, if missing, funtion will create a new one.
#' @param constraintLabel string label to apply to the constraint.
Modified: pkg/quantstrat/man/setParameterConstraint.Rd
===================================================================
--- pkg/quantstrat/man/setParameterConstraint.Rd 2011-09-07 20:00:43 UTC (rev 761)
+++ pkg/quantstrat/man/setParameterConstraint.Rd 2011-09-08 12:32:01 UTC (rev 762)
@@ -7,29 +7,44 @@
}
\arguments{
\item{paramConstraintObj}{the ParameterConstraint object
- to be updated on, if missing, funtion will create a new
+ to be updated, if missing, funtion will create a new
one.}
\item{constraintLabel}{string label to apply to the
- constraint}
+ constraint.}
\item{paramList}{the two name of the prameters as a list
contains two strings.}
\item{relationship}{relationship between the 1st
parameter and 2nd one. ('gt' means 1st parameter > 2nd
- parameter)}
+ parameter).}
}
+\value{
+ The returned object is a structure contains the
+ constraints on pairs of parameters, if the input argument
+ 'paramConstraintObj' is provided, the function update the
+ input paramConstraintObj object and return the updated
+ one. When specify the constraints of several pairs of
+ parameters, usually the first returned object is passed
+ to the next several call of the function as input
+ argument 'paramConstraintObj'. See example.
+}
\description{
- Function to construct parameter constraint object.
+ Function to construct parameter constraint object. The
+ returned value will be one of the inputs to the
+ applyParameter function.
}
\examples{
#(For complete demo see parameterTestMACD.R)
-#In a MACD strategy, we want to fast macd calcuated from less time periods (days) than slow macd signal:
+#In a MACD strategy, we want to fast macd calcuated from less time periods (days)
+#than slow macd signal:
\dontrun{
-pConstraint2<-setParameterConstraint(constraintLabel='macdPC',paramList=c('nFast','nSlow'),relationship='lt')
+x<-setParameterConstraint(constraintLabel='macdPC',
+paramList=c('nFast','nSlow'),relationship='lt')
}
-#The object pConstraint2 then can be used in applyParameter function to specify the constrains between parameters.
+#The object x then can be used as one of the inputs to applyParameter function to specify the
+#constraints between parameters.
}
\author{
Yu Chen
Modified: pkg/quantstrat/man/setParameterDistribution.Rd
===================================================================
--- pkg/quantstrat/man/setParameterDistribution.Rd 2011-09-07 20:00:43 UTC (rev 761)
+++ pkg/quantstrat/man/setParameterDistribution.Rd 2011-09-08 12:32:01 UTC (rev 762)
@@ -1,6 +1,6 @@
\name{setParameterDistribution}
\alias{setParameterDistribution}
-\title{Function used to set distribution of a parameter to be generated from, for testing a strategy.}
+\title{Function used to create an object that contains the distribution of parameters to be generated from, before testing parameters of a strategy.}
\usage{
setParameterDistribution(paramDist = NULL, type = NULL,
indexnum = 0, distribution = NULL, weight, label, psindex
@@ -9,42 +9,45 @@
\arguments{
\item{paramDist}{The object that store the parameter
list, if this parameter is missing, or object does not
- exist, the function will create a new object.}
+ exist, the function will return a new object.}
\item{type}{A character string that specifies the type of
- the parameter, it takes the value of one of 'indicator',
+ the parameter, it takes the value in one of 'indicator',
'signal', 'enter', 'exit', 'order'.}
- \item{indexnum}{Tells the sequence within the type, (If
- the type is 'signal', indexnum =2 tells the function to
- update the 2nd signal in the strategy)}
+ \item{indexnum}{Tells the sequence within the type, (for
+ example: type = 'signal', indexnum =2 tells the function
+ to update the 2nd signal in the strategy)}
\item{distribution}{Distribution of the parameter, can be
- any function that return a vector of value. See detail.
+ any function that returns a vector of value. See detail.
(A numerical example: 1:10 or sample(1:20,6)}
\item{weight}{The weight of each value in the
- distribution, default value will be all equally
- weighted.}
+ distribution, if missing, the default value of all equal
+ weights will be taken.}
- \item{label}{string label to apply to the parameter
+ \item{label}{A string label to apply to the parameter
distribution}
- \item{psindex}{specify the index within the parameter
- distribution object, it is used to make change/ repalce a
- parameter distribution in the object.}
+ \item{psindex}{A number specify the index within the
+ parameter distribution object, it is used to make change/
+ repalce a parameter distribution in the object.}
}
\value{
The returned object is a structure contains the
- distribution of parameters, is of the same type as the
- input parameter paramDist (if provided), the function
- update the input paramDist object and return the updated
- one. Usually the returned value is pass to the same
- object as parameter. See details.
+ distribution of parameters, if the input argument
+ 'paramDist' is provided, the function update the input
+ paramDist object and return the updated one. When specify
+ the distribution of several parameters, usually the first
+ returned object is passed to the next several call of the
+ function as input argument 'paramDist'. See example.
}
\description{
Each call to the function will set/update the
- distribution of ONE parameter in the strategy.
+ distribution of ONE parameter in the 'parameter
+ distribution object' that is associated with a specific
+ strategy.
}
\details{
When call the function, the user must know the parameter
@@ -56,19 +59,22 @@
Type of the parameter and the sequence in that type is
needed to specify the exact parameter in THAT STRATEGY.
- The parameter of the function 'distribution' is a list
- contains vector of values named WITH THE NAME OF THE
- PARAMETER, the values can be any type (integer,
- characters, etc) matches with the leagal value of that
- parameter. For example: distribution=list(nFast=(10:30))
- or distribution=list(relationship=c('gt','gte'))
+ The parameter 'distribution' is a list contains vector of
+ values NAMED WITH THE NAMES OF THE PARAMETERS, the values
+ can be any type (integer, characters, etc) but must match
+ with the leagal value of that parameter. For example:
+ distribution=list(nFast=(10:30)) or
+ distribution=list(relationship=c('gt','gte'))
}
\examples{
\dontrun{
#(For complete demo see parameterTestMACD.R)
-tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast')
-tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nSlow=(20:40)),label='nSlow')
-tPD2<-setParameterDistribution(tPD2,'signal',indexnum=1,distribution=list(relationship=c('gt','gte')),label='sig1.gtgte')
+tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,
+distribution=list(nFast=(10:30)),label='nFast')
+tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,
+distribution=list(nSlow=(20:40)),label='nSlow')
+tPD2<-setParameterDistribution(tPD2,'signal',indexnum=1,
+distribution=list(relationship=c('gt','gte')),label='sig1.gtgte')
}
}
\author{
More information about the Blotter-commits
mailing list