Displaying 3 results from an estimated 3 matches for "subperiods".
Did you mean:
subperiod
2009 Jun 01
0
vectorizing a double loop
...ugh to vectorize this.
here is the code of my function:
momentum = function(price,H,N,HL) {
indicator = price #creates the empty vector for the indicator
indicator[,1]=0
if ((H/N)==floor(H/N)) { #Checks if length of subperiods is an integer
for (i in 1:(length(indicator)-H)) {
ph=last(price,H+1) #Horizon time data list
horizonPerformance=as.numeric(last(ph))/as.numeric(first(ph))-1 #Performance over the time horizon
for (j in 1:N) {
phj=last(f...
2012 Feb 15
2
Control number of assets in resulting portfolio with optimizations using package fPortfolio
...g package fPortfolio to run minimum variance portfolio
optimizations in R. I already know how to set portfolioSpecs, portfolio
objects and constraints. Unfortunately I am not able to set the following
type of constraints.
I have a timeSeries object with returns data for roughly 1.5k assets for 261
subperiods (workingdays) and want to compute the global minimum variance
portfolio, considering following constraints:
- Leverage = 1 (fully invested)
- the lower / upper weights constraints (can be done by box
constraints) for individual assets are e.g. +0,01 / +0,04
-...
2002 Aug 30
4
Intercept in model formulae.
Hi,
I'm trying to create a linear model for a dataset that has a breakpoint e.g.
# dummy dataset
x <- 1:20
y <- c(1:10,seq(10.5,15,0.5))
plot(x,y)
I've modelled this using the following formula:
temp <- lm(y ~ x*(x<=10)+x*(x>10))
I want to be able to omit the intercept (i.e. force the line through
zero) from the first of these segments (x<=10) so that I'm only