Thursday, June 30, 2016

copywriting - Why do we have OS names like Mountain Lion, Jellybean, and Quantal Quetzal instead of numbers?


Less of a pressing question and more a "what happened here"?



At some point in the past decade (most) OS's have switched over to these codenames for their versions with names like Mountain Lion, Jellybean, etc. After a heated discussion with my Dad (who prefers version numbers) about why the names would be done like this, it dawned on me to ask if there was a (valid) UX reason for it vs. just a marketing/trademark one.


I don't think this idea has been explored all that well, just because we have such scattered implementations of it -- Android and Ubuntu are the only ones who use alphabetized naming conventions as a reinforcement of version numbering, Apple uses it for OSX (Snow Leopard, Lion...) but not for iOS (iOS4, iOS5...), and Windows isn't consistent about this stuff at all (XP, then Vista, then 7, then 8...)


Is there any rhyme / reason to all of this?



Answer




A few of my guesses:



  • Numbers are harder to anthropomorphize - we've reached a point with our understanding of computers where we regularly refer to the computer as another being we regularly interact with. It's much easier to give this creature some kind of name vs. a number, especially given that numbers are often used to "dehumanize" things and make them impersonal -- so giving "inhuman" things a name should produce the opposite result.

  • Names are more memorable than numbers - A huge problem in dealing with all these different devices and builds is that remembering your given OS's version number is... difficult, especially for less dedicated users. Remembering the name of an OS means that people providing tech support can more quickly ID a product version and tailor their advice accordingly.

  • Names are easier to search for (and provide information on) - Google may have caused this trend inadvertently. Because we search using words as opposed to numbers for most things, there's a much higher noise-to-signal ratio when looking for Something Something 7 (because we also get stuff for Something Something 6, and Something Something 5, and...) vs. SSSSSSSomething. Yes, Google does have some safeguards for this problem, such as relevancy and recency of data, but names still work as a good shortcut, which leads to...

  • Named Versions are harder to get confused with than Numbered Versions -- You can imagine that confusing something like 10.3.2 and 10.3.3 is easy enough, because they sound very similar, but not so much with Ice Cream Sandwich vs. Jellybean, because they don't sound (or produce mental images of) the same things.



I'm not sure whose approach I like better at this point, Android's vs. Ubuntu's -- The reinforced alliteration in Ubuntu's system (e.g. Quantal Quetzal) makes it produce more unique names while reinforcing the numbering system, but at the risk of making the names harder to memorize. Android's system is better geared towards an easy visual representation (which makes it easier to remember), but a less unique name.


Wednesday, June 29, 2016

adobe illustrator - Script for random movement (scatter)


I have found (and use) scripts for random opacity, random resize, random rotation etc. but I can't seem to find one which will do a "random displacement/move"


With the other above mentioned scripts, you simply select the paths, run the script and enter in a minimum value and a maximum value and the computer randomizes it for you. (Say min 20% opacity, max 80% opacity - they will all be between 20-80% opacity)


Is this script difficult to create?



Couldn't it just be enter in min -X and min -Y to max X and max Y movement? Then the computer would just choose a random value as it does in the other scripts.



Answer



enter image description here


Here is a implementation of uniform box scatter


scatter_box(activeDocument.selection, 100, 100);

function scatter_box(items, xoffset, yoffset){
for(var i=0;i var oldpos = items[i].position;
items[i].position= [oldpos[0]+Math.random()*xoffset-xoffset/2,

oldpos[1]+Math.random()*yoffset-yoffset/2];
}
}

Here for uniform disc scatter.


scatter_disk(activeDocument.selection, 50);


function scatter_disk(items, rad){
for(var i=0;i
var oldpos = items[i].position;
var r = Math.sqrt(Math.random()*rad*rad);
var theta = Math.random()*2*Math.PI;
items[i].position= [oldpos[0]+r*Math.sin(theta),
oldpos[1]+r*Math.cos(theta)];
}
}

Obviously you could use other random distributions too.





GUI version


#target illustrator

buildGUI();

function buildGUI(){
var resource =
"dialog { text:'jooScatter',\
properties:{ closeButton:true, maximizeButton:false,\
minimizeButton:false, resizeable:false },\

orientation:'row', spacing:2, margins:5,\
alignChildren:['left','fill'],\
g: Group {\
alignChildren:['left','fill'],\
orientation:'column', spacing:20,margins:5,\
p1: Panel {\
text: 'Scatter Offsets:',\
g1: Group {\
orientation:'column',\
x: Group {\

st: StaticText { text:'x width:'},\
f: EditText {text:'100', characters:20}\
},\
y: Group {st2 : StaticText{ text:'y width:'},\
f: EditText { text:'100' , characters:20 },\
},\
},\
},\
g2: Group { alignment: 'right', orientation:'row',\
apply: Button { text: 'Apply'},\

cancel: Button { text:'Cancel'},\
}\
}\
}"
var win = new Window (resource);

var cancel = function() {
win.close(0);
}
var apply = function() {

scatter_box(activeDocument.selection,
eval(win.g.p1.g1.x.f.text),
eval(win.g.p1.g1.y.f.text)
);
redraw();
}

win.g.g2.apply.onClick = apply;
win.g.g2.cancel.onClick = cancel;


win.show();



}

function scatter_box(items, xoffset, yoffset){
for(var i=0;i var oldpos = items[i].position;
items[i].position= [oldpos[0]+Math.random()*xoffset-xoffset/2,

oldpos[1]+Math.random()*yoffset-yoffset/2];
}
}

GIF of it in action here


adobe illustrator - eps file vector quality issue


I have a large vector .eps file of 8 logo samples. At 100% zoom, it is crisp and gorgeous, about 4 inches wide and 1.5 inches high on my laptop screen.


I tried object > rasterize with CMYK / 300dpi / type anti-aliasing, but lost quality and it was pasted into a new art-board at a much smaller size.


I want to save it as PNG and EPS (yes 2 files) but in a larger size, 500% zoomed for example in the original EPS file when exporting to new file, without losing any quality, especially when I downsize it and the fonts should not lose quality at all.


I'm new to Illustrator and it is different from Photoshop function wise. How do I export a PNG version at that size and quality?



Answer



They'll never really be the same quality. The EPS will scale to the resolution of any device that can render it. The PNG's resolution is fixed to whatever you output.


The question is: How will the PNG be used? On screen I hope. Identify the highest resolution device to be targeted and export to that pixel size. If you want ideal rendering on several devices, export several versions


In Illustrator:

1. open your EPS
2. scale to the pixel size you need
3. export via "Save for Web"
4. select PNG-24 for maximum quality


You can scale it up further in the SFW dialog by adjusting the "Image size" (don't forget to hit "Apply") without any quality loss. Whatever settings you provide in SFW will be rendered from the vector original.


Calculate Returns of Momentum Strategy (Overlapping Portfolios - Jegadeesh and Titman 1993)


I want to implement a Momentum Strategy, followed by Jegadeesh and Titman (1993) with overlapping Portfolios. I want to duplicate their results.


Quick Link to the paper (Unfortunately the Method is poorly described): http://www.business.unr.edu/faculty/liuc/files/BADM742/Jegadeesh_Titman_1993.pdf


First of all: I work with discrete monthly Returns. But I don't know which returns I have to calculate to implement my Momentum Strategy properly.


Let's consider Formationperiod J=3 and Holdingperiod K=3



In this case I have a composite Portfolio consisting of the Portfolio initiated in JAN (Tranche 1), a Portfolio initiated in FEB (Tranche 2, hold for 2 Periods) and the portfolio initiated in MAR (Tranche 3, hold for 1 Period).


enter image description here


What Returns do I have to calculate now to duplicate the Method of Jegadeesh and Titman (1993)?


My attempt would be: In March, I calculate the Return of Tranche 1. This Portfolio was acutally held for 3 Months and so we liquidate it and measure it's Return with the Geometric Mean (Because I have discrete Returns). This is the first observation of my Strategy.


But I can also calculate the Return of the composite Portfolio (vertical aggregation) for the month March. I calculate the Return of the composite Portfolio (Consisting 3 Sub-Portfolios) in March and divide it by 3 (Arimethic Mean) so that I have the average Returns of all 3 Sub-Portfolios for the Month March in my Composite Portfolio. This results in having for March 2 Observations, the Return of my liquidated Sub-Portfolio and the Return of my Composite Portfolio for the Month. In April I have the monthly Return of Tranche 2 and the composite Portfolio (Consisting Tranche2, 3 and the new Tranche 1). For every Month I sum up these two observations and take the Mean. This continues every Month. At the end I sum every Return of each Month up and take the mean of that to have the Monthly Returns of my actual Strategy.


Is this the proper way to calculate the Returns of a Momentum Strategy? Or do I just calculate composite Portfolio Returns?


I would really appreciate your help!


With kind regards!




software - Efficiently storing real-time intraday data in an application agnostic way


What would be the best approach to handle real-time intraday data storage?


For personal research I've always imported from flat files only into memory (historical EOD), so I don't have much experience with this. I'm currently working on a side project, which would require daily stock quotes updated every minute from an external feed. For the time being, I suppose any popular database solution should handle it without sweating too much in this scenario. But I would like the adopted solution to scale easily when real-time ticks become necessary.


A similar problem has been mentioned by Marko, though it was mostly specific to R. I'm looking for a universal data storage accessible both for lightweight web front-ends (PHP/Ruby/Flex) and analytical back-end (C++, R or Python, don't know yet).



From what chrisaycock mentioned column oriented databases should be the most viable solution. And it seems to be the case.


But I'm not sure I understand all the intricacies of column oriented storage in some exemplary usage scenarios:



  • Fetching all or subset of price data for a specific ticker for front-end charting

    • Compared to row based solutions fetching price data should be faster because it's a sequential read. But how does storing multiple tickers in one place influence this? For example a statement like "select all timestamps and price data where ticker is equal to something". Don't I have to compare the ticker on every row I fetch? And in the situation where I have to provide complete data for some front-end application, wouldn't serving a raw flat file for the instrument requested be more efficient?



  • Analytics performed in the back-end


    • Things like computing single values for a stock (e.g. variance, return for last x days) and dependent time-series (daily returns, technical indicators etc.). Fetching input data for computations should be more efficient as in the preceding case, but what about writing? The gain I see is bulk writing the final result (like value of computed indicator for every timestamp), but still I don't know how the database handles my mashup of different tickers in one table. Does horizontal partitioning/sharding handle it for me automatically or am I better splitting manually into table per instrument structure (which seems unnecessary cumbersome)?



  • Updating the database with new incoming ticks

    • Using row based orientation would be more efficient here, wouldn't it? And the same goes about updating aggregated data (for example daily OHLC tables). Won't it be a possible bottleneck?




All this is in the context of available open source solutions. I thought initially about InfiniDB or HBase, but I've seen MonetDB and InfoBright being mentioned around here too. I don't really need "production quality" (at least not yet) as mentioned by chrisaycock in the referenced question, so would any of this be a better choice than the others?



And the last issue - from approximately which load point are specialized time-series databases necessary? Unfortunately, things like kdb+ or FAME are out of scope in this case, so I'm contemplating how much can be done on commodity hardware with standard relational databases (MySQL/PostgreSQL) or key-value stores (like Tokyo/Kyoto Cabinet's B+ tree) - is it a dead end really? Should I just stick with some of the aforementioned column oriented solutions owing to the fact that my application is not mission critical or is even that an unnecessary precaution?


Thanks in advance for your input on this. If some part is too convoluted, let me know in a comment. I will try to amend accordingly.


EDIT:


It seems that strictly speaking HBase is not a column oriented store but rather a sparse, distributed, persistent multidimensional sorted map, so I've crossed it out from the original question.


After some research I'm mostly inclined towards InfiniDB. It has all the features I need, supports SQL (standard MySQL connectors/wrappers can be used for access) and full DML subset. The only thing missing in the open source edition is on the fly compression and scaling out to clusters. But I guess it's still a good bang for the buck, considering it's free.



Answer



Column-oriented storage is faster for reading because of the cache efficiency. Looking at your sample query:


select price, time from data where symbol = `AAPL

Here I'm concerned with three columns: price, time, and symbol. If all ticks were stored by row, the database would have to read through all rows just to search for the symbols. It would look like this on disk:



IBM | 09:30:01 | 164.05; IBM | 09:30:02 | 164.02; AAPL | 09:30:02 | 336.85

So the software must skip over the price and time entries just to read the symbols. That would cause a cache miss for every tick!


Now let's look at the column-oriented storage:


IBM | IBM | AAPL; 09:30:01 | 09:30:02 | 09:30:02; 164.05 | 164.02 | 336.85

Here the database can sequentially scan the symbol list. This is cache efficient. Once the software has the array indices that represent the symbol locations of interest, the database can jump to the specific time and price entries via random access. (You may notice that the columns are actually associative arrays; the first element in each column refers to the first row in aggregate, so jumping to the N th row means simply accessing the N th element in each array.)


As you can imagine, column-oriented storage really shines during analytics. To compute the moving average of the prices per symbol, the database will index-sort the symbol column to determine the proper ordering of the price entries, and then begin the calculation with the prices in contiguous (sequential) layout. Again, cache efficient.




Beyond the column-oriented layout, many of these really new databases also store everything in memory when performing calculations. That is, if the data set is small enough, the software will read the entire tick history into memory, which will eliminate page faults when running queries. Thus, it will never access the disk!



A second optimization that kdb+ does is that it will automatically enumerate text. (This feature is inspired by Lisp symbols). So searching for a particular stock does not involve typical string searching; it's simply an integer search after the initial enumeration look-up.


With the sequential storage, in-memory allocation, and the automatic text enumeration, searching for a symbol is really just scanning for an integer in an array. That's why a database like kdb+ is a few orders of magnitude faster than common relational databases for reading and analytics.




As you've pointed-out in your question, writing is a weakness of column-oriented storage. Because each column is an array (in-memory) or file (on-disk), changing a single row means updating each array or file individually as opposed to simply streaming the entire row at once. Furthermore, appending data in-memory or on-disk is pretty straightforward, as is updating/inserting data in-memory, but updating/inserting data on-disk is practically impossible. That is, the user can't change historical data without some massive hack.


For this reason, historical data (stored on-disk) is often considered append-only. In practice, column-oriented databases require the user to adopt a bitemporal or point-in-time schema. (I advise this schema for financial applications anyway for both better time-series analysis and proper compliance reporting.)




I don't know enough about your application to determine performance or production-level requirements. I just hope the above guide will help you make an informed decision with regard to why column-oriented storage is often your best bet for analytics.


adobe photoshop - How do I create subtle background gradients like this?


This has been bugging me for ages. I want to recreate the shadows that are on the background of this image. Whenever I attempt to recreate something like this the shading ends up looking very amateur no matter how much noise or blur I add or how many layers I introduce. I would really appreciate help on this!


Background Gradient



Answer



I would look at this as either



  • A spotlight with a hot center, and with a falloff at the edge of the spot light


  • Partly lens vignetting

  • A combination


The latter often give a more realistic and natural look than just one of the top options.


It's easy to do this with 3D software for the light and then add vignetting in Photoshop or After Effects. But you could get close using these steps in Photoshop:



  1. Fill background with brightest color

  2. Add a circle mask representing the outer rim of the spot light

  3. Turn selection into a mask for an empty layer, invert mask, blur it to create soft edge and fill layer with black.

  4. Dial down the opacity of the layer (I'm using 14% below)


  5. Create a new layer for vignette. Manually draw in black solid in the upper and bottom right corners. Blur it (f.ex. 75 for Gaussian blur).

  6. Dial down opacity, optionally stretch and re-position the layer to your liking (I'm using 41% below)

  7. Throw on a LUT effect on top to warm up the result (I used FallColors for the result below at 19% opacity)

  8. If too much banding add some noise/grain, work in 16-bit mode etc.


It got me this result - I could have spent more time tweaking the vignette and spot layer's opacity but you'll get the idea:


Step 1


step 1


Step 2-3


step 2-3



Step 5 A


step 5a


Step 5 B


step 5b


Result


With LUT effect. The vignette layer was stretched downward in this end result.


demo result


time series - Is R being replaced by Python at quant desks?


I know the title sounds a little extreme but I wonder whether R is phased out by a lot of quant desks at sell side banks as well as hedge funds in favor of Python. I get the impression that with improvements in Pandas, Numpy and other Python packages functionality in Python is drastically improving in order to meaningfully mine data and model time series. I have also seen quite impressive implementations through Python to parallelize code and fan out computations to several servers/machines. I know some packages in R are capable of that too but I just sense that the current momentum favors Python.


I need to make a decision regarding architecture of a subset of my modeling framework myself and need some input what the current sentiment is by other quants.


I also have to admit that my initial reservations regarding performance via Python are mostly outdated because some of the packages make heavy use of C implementations under the hood and I have seen implementations that clearly outperform even efficiently written, compiled OOP language code.


Can you please comment on what you are using? I am not asking for opinions whether you think one is better or worse for below tasks but specifically why you use R or Python and whether you even place them in the same category to accomplish, among others, the following tasks:




  • acquire, store, maintain, read, clean time series

  • perform basic statistics on time series, advanced statistical models such as multivariate regression analyses,...

  • performing mathematical computations (fourier transforms, PDE solver, PCA, ...)

  • visualization of data (static and dynamic)

  • pricing derivatives (application of pricing models such as interest rate models)

  • interconnectivity (with Excel, servers, UI, ...)

  • (Added Jan 2016): Ability to design, implement, and train deep learning networks.


EDIT I thought the following link might add more value though its slightly dated [2013] (for some obscure reason that discussion was also closed...): https://softwareengineering.stackexchange.com/questions/181342/r-vs-python-for-data-analysis



You can also search for several posts on the r-bloggers website that address computational efficiency between R and Python packages. As was addressed in some of the answers, one aspect is data pruning, the preparation and setup of input data. Another part of the equation is the computational efficiency when actually performing statistical and mathematical computations.


Update (Jan 2016)


I wanted to provide an update to this question now that AI/Deep Learning networks are very actively pursued at banks and hedge funds. I have spent a good amount of time on delving into deep learning and performed experiments and worked with libraries such as Theano, Torch, and Caffe. What stood out from my own work and conversations with others was that a lot of those libraries are used via Python and that most of the researchers in this space do not use R in this particular field. Now, this still constitutes a small part of quant work being performed in financial services but I still wanted to point it out as it directly touches on the question I asked. I added this aspect of quant research to reflect current trends.



Answer



My deal is HFT so what I care about is



  1. read/load data from file or DB quickly in memory

  2. perform very efficient data-munging operations (group,transform)

  3. visualize easily the data



I think is is pretty clear that 3. goes to R, graphics and ggplot2 and others allow you to plot anything from scratch with little effort.


About 1. and 2. I am amazed reading previous post to see that people are advocating for python based on pandas and that no one cites data.table The data.table is a fantastic package that allows blazing fast grouping/transforming of tables with 10s million rows. From this bench you can see that data.table is multiple time faster than pandas and much more stable (pandas tend to crash on massive tables)


Example


R) library(data.table)
R) DT = data.table(x=rnorm(2e7),y=rnorm(2e7),z=sample(letters,2e7,replace=T))
R) tables()
NAME NROW NCOL MB COLS KEY
[1,] DT 20,000,000 3 458 x,y,z
Total: 458MB
R) system.time(DT[,.(sum(x),mean(y)),.(z)])

user system elapsed
0.226 0.037 0.264

R)setkey(DT,z)
R)system.time(DT[,.(sum(x),mean(y)),.(z)])
user system elapsed
0.118 0.022 0.140

Then there is speed, as I work in HFT neither R nor python can be used in production. But the Rcpp package allows you to write efficient C++ code and integrate it to R trivially (literally adding 2 lines). I doubt R is fading, given the number of new packages created every day and the momentum the language has...


EDIT 2018-07



A few years latter I am amazed by how the R ecosystem has evolved. For in-memory computation you get unmatched tools, from fst for blazing fast binary read/write, fork or cluster parallelism in one liners. C++ integration is incredibly easy with Rcpp. You get interactive graphics with the classics like plotly, crazy features like ggplotly (just makes your ggplot2 interactive). For trying python with pandas I honestly do not understand how there could even be a match. Syntax is clunky and performance is poor, I must be too used to R I guess. Another thing that is really missing in python is litterate programming, nothing comes close to rmarkdown (the best I could find in python was jupyter but that does even come close). With all the fuss surrounding the R vs Python langage war I realize that vast majority of people are simply uninformed, they do not know what data.table is, that it has nothing to do with a data.frame, they do not know that R fully supports tensorflow and keras.... To conclude I think both tools can do everything and it seems that python langage has very good PR...


usability - Should a dropdown list be closed when mouse leaves?


Should a dropdown list be automatically closed when you leave current object and navigate to another, or should it remain opened until you open next dropdown list?






  1. Dropdown closed when mouse leaves


Option 1





  1. Dropdown remains opened


Option 2




Answer



For consistency, the behavior should be based on the calling action; click or hover.


If you are opening the dropdown on click, let the user toggle and close it, or close the previous dropdown when user clicks on another thumbnail.


If you are opening the dropdown on mouse-over, close it on mouse-out.


Tuesday, June 28, 2016

adobe photoshop - Matching CMYK photo with Pantone colour


I have a product photo from a client to include in their flyer. I'm trying to get it so that it blends in with the green background (which is a Pantone)



Here you can see how the doc looks in InDesign


enter image description here


I think the greens don't really match too well. However, if I enable Overprint Preview in InDesign, then they match a little better:


enter image description here


Which one do I 'trust' so to speak? Should I focus on getting them to match when Overprint Preview is enabled or disabled?


Also I have just tried setting the image to grayscale and colouring it in InDesign using the Pantone and the colour black... it blends in nicely to the background but looks a little dull?


enter image description here



Answer



The last example is on the right track, but looks a little dull because multiplying or coloring the image in InDesign removes the white color. To maintain the white you could try this:


Duotone



A duotone image (aka. duplex) is a two-color image. It is in reality a grayscale image which contains the information needed to print it in two colors. Each of the colors have an old-school curve controlling how they are distributed.


It is often used with process black and a Pantone color or two Pantone colors. You could also use it to make two black channels - a pale one for the light tones and a more contrasty one for the darkest areas.


Anyway, let's try it out with your image (I just used the low res image from your post).


First of all i have converted the image to grayscale. I used Black & White and Curves to make sure that the whitest point was 0% black, the darkest point 100% black and that the part of the image which has neither shadow or highlight was about 50% (this almost matches the background). Knowing that duotone images tend to look a little bit flat i also added a little bit of contrast in the process.


grayscale


Make sure the image is grayscale and flattened and open Image/Mode/Duotone. Set Type to Duotone. Click the color swatches to select two colors. I have selected black and Pantone 333 (a guess).


duotone dialogue


We can see that the two colors both have a flat curve. Where there is X% black in the original grayscale image there is X% of each color. This setting doesn't look too good in most cases.


default duotone


Let's fiddle with the curves. We enter the curve for the black color by clicking it.



black curve


We will keep it simple (you can experiment on your own) and just enter 0 in the 50 field. This way we make all the light tones in the image contain no black color. First when we get above 50% the black color enters the image and it is present in all the darkest part of the image. Earlier we made the grayscale image with around 50% black in the parts we wanted to give the clean Pantone color. Now we have made sure that there is no black polluting that clean Pantone color.


Next, the Pantone curve.


Pantone curve


Here we set the Pantone color to cover (be at 100% tint) from 50% and up in the original grayscale image. It just mixes with the black in the dark areas making them extra black (with a slight grennish tint). In my experience it creates strange-looking transitions in the colors if you knock out the black. I added the slight correction at 10% because I wanted a little more white highlight.


The result looks like this:


custom duotone


I might have been to generous with the contrast or maybe the duotone curves needs more fine tuning, but in the end it's all a matter of taste. There is no right way to do a two-color image. It is non-standard. We are leaving color profiles behind.


The duotone image must be saved as psd. Be sure to name the colors to match your inks in InDesign. Notice that you can enter Image/Mode/Duotone and refine the curves and choose different colors as many times as you want.


Regarding previewing



In your first example (with and without Overprint Preview) you are trying to match the color of an RGB/CMYK image to match the Pantone, right? That is hard and maybe, with that color, impossible.


You cannot trust the screen to show the exact Pantone colors, but it gives you a good idea. I have made a few things were I mixed Pantone colors and I was surprised how good the preview was. But you have to combine it with looking at samples and using your common sense. See it more as constructing an image than painting one. If you know there is 100% of the Pantone color then you have to imagine it to match the physical sample.


Even the guide books vary quite a lot from book to book. Furthermore, when you choose a Pantone color you just choose which color to apply. There is no guarantee that the actual print will look that way. That depends on the material.


Monday, June 27, 2016

risk neutral measure - Numéraire -- couldn't understand the wiki explanation


I'm trying to understand Numéraire concept so am reading the wiki page:


I couldn't understand the last formula's 2nd equation:


$$ E_{Q}\left[\left.\frac{M(0)}{M(T)}\frac{N(T)}{N(0)}\frac{S(T)}{N(T)}\right| \mathcal{F}(t)\right]/ E_Q\left[\left.\frac{M(0)}{M(T)}\frac{N(T)}{N(0)}\right| \mathcal{F}(t)\right] = \frac{M(t)}{N(t)}E_{Q}\left[\left.\frac{S(T)}{M(T)}\right| \mathcal{F}(t)\right] $$


Why so? Which part from the left hand side is mapped into $\frac{M(t)}{N(t)}$ and which part mapped to $E_{Q}\left[\left.\frac{S(T)}{M(T)}\right| \mathcal{F}(t)\right] $?


Just for reference, below is copied from the wiki page.


-- begin of wiki >>


In a financial market with traded securities, one may use a change of numéraire to price assets. For instance, if $M(t)=exp(∫_0^t r(s)ds)$ is the price at time $t$ of $\$1$ that was invested in the money market at time $0$, then all assets (say $S(t)$), priced in terms of the money market, are martingales with respect to the risk-neutral measure, (say $Q$). That is $$\frac{S(t)}{M(t)}=E_Q\left[\left.\frac{S_T}{M_T} \right| F_t\right], ∀t≤T$$


Now, suppose that $N(t)>0$ is another strictly positive traded asset (and hence a martingale when priced in terms of the money market). Then, we can define a new probability measure $Q^N$ by the Radon–Nikodym derivative $$\frac{d Q^N}{dQ}=\frac{N_T/N_0}{M_T/M_0}$$


Then, by using the abstract Bayes' Rule it can be shown that $S(t)$ is a martingale under $Q^N$ when priced in terms of the new numéraire, $N(t)$:



$$ E_{Q^N}\left[\left.\frac{S(T)}{N(T)}\right| \mathcal{F}(t)\right] $$ $$= E_{Q}\left[\left.\frac{M(0)}{M(T)}\frac{N(T)}{N(0)}\frac{S(T)}{N(T)}\right| \mathcal{F}(t)\right]/ E_Q\left[\left.\frac{M(0)}{M(T)}\frac{N(T)}{N(0)}\right| \mathcal{F}(t)\right] $$ $$ = \frac{M(t)}{N(t)}E_{Q}\left[\left.\frac{S(T)}{M(T)}\right| \mathcal{F}(t)\right] = \frac{M(t)}{N(t)}\frac{S(t)}{M(t)} = \frac{S(t)}{N(t)} $$


<< end of wiki--



Answer



If you are interested in the proof of the Baye's Rule for conditional expectations you can find it here


The sake of completeness:



The Baye's rule for conditional expectations states


$$ E^Q[X|\mathcal{F}]E^P[f|\mathcal{F}]=E^P[Xf|\mathcal{F}] $$


With $f=dQ/dP$ - thus being the Radon-Nikodyn derivative and $X$ being some random variable and $\mathcal{F}$ being some sigma-algebrad.




Now we need to apply that rule to the change of numeraire context. From the Change of Numeraire Theorem we not that $dQ^N/dQ^M$ is given by $$ f=\frac{dQ^N}{dQ^M}=\frac{M(0)N(T)}{M(T)N(0)} $$


In the next step we insert this $f$ into above theorem and also subtitute $X$ for $S(T)/N(T)$


$$ E^{Q^N}\left[\frac{S(T)}{N(T)}|\mathcal{F}_t\right]E^{Q^M}\left[\frac{M(0)N(T)}{M(T)N(0)}|\mathcal{F}_t\right]=E^{Q^M}\left[\frac{S(T)}{N(T)}\frac{M(0)N(T)}{M(T)N(0)}|\mathcal{F}_t\right] $$


$\frac{S(T)}{N(T)}\frac{M(0)N(T)}{M(T)N(0)}$ simplifies to $\frac{S(T)}{M(T)}\frac{M(0)}{N(0)}$.


Now perhaps the crucial step. $N(t)$ is a numeraire and thus a tradeable asset. $M(t)$ is also a numeraire and $Q^M$ is its equivalent measure. Thus $N(t)/M(t)$ is a martingale under $Q^M$. This leads to


$$E^{Q^M}\left[\frac{M(0)N(T)}{M(T)N(0)}|\mathcal{F}_t\right]=\frac{M(0)N(t)}{M(t)N(0)}$$


Deviding by this fraction results in


$$ E^{Q^N}\left[\frac{S(T)}{N(T)}|\mathcal{F}_t\right]=\frac{N(0)M(t)}{N(t)M(0)}E^{Q^M}\left[\frac{S(T)}{M(T)}\frac{M(0)}{N(0)}|\mathcal{F}_t\right]= \frac{N(0)M(t)}{N(t)M(0)}\frac{M(0)}{N(0)}E^{Q^M}\left[\frac{S(T)}{M(T)}|\mathcal{F}_t\right]$$


This leads to


$$E^{Q^N}\left[\frac{S(T)}{N(T)}|\mathcal{F}_t\right]=\frac{M(t)}{N(t)}E^{Q^M}\left[\frac{S(T)}{M(T)}|\mathcal{F}_t\right]$$



Now we know that $S(t)/M(t)$ is a martingale under $Q^M$. Thus the desired result follows.


$$E^{Q^N}\left[\frac{S(T)}{N(T)}|\mathcal{F}_t\right]=\frac{M(t)S(t)}{N(t)M(t)}$$


plot - Is it OK to invent as I write, or should I plan the entire story first?


I have read Harry Potter and am a big fan of J.K. Rowling's writing and I had always had this urge to blog and to write. So, I started a blog - 2200 Common Era.


I've the basic idea of writing a science fiction set in the backdrop of space. I don't know the whole story or to say, I don't have the whole story in my mind.


I decide what should be written next only when I am writing that. So, I want to ask what should I do? Should I build the whole story and then reproduce it in written, or think of story each time I write?



Answer





I decide what should be written next only when I am writing that.



This called being a "pants writer" or a "pantser," meaning that you write by the seat of your pants. It's completely valid as a workflow, IF you are then willing to go back to the beginning when you're finished and edit with a firm, even harsh hand.


Just because it spews out of you doesn't mean the plot will work, the characters will be intriguing, or all the questions will be answered. So you will have to go back and tweak, fix, rewrite, and possibly unravel chunks of the story.


On the other hand, you can't edit a blank page. If you pants the entire thing, you will have a book to wrangle into shape.


I say go for it. Write what comes out, write to the end, and then go back and fix it afterward. Just remember that for a pantser, the editing and rewriting are part of your first draft process, not optional passes.


Sunday, June 26, 2016

currency - Fama-French Factors in €


I am having a bit of a problem with currency conversion issues. What I do: I sort European stocks based on their book-to-market ratio, each year I form a portfolio (equal-weight) with the 10 stocks that have the highest book-to-market ratio. I calculate the return on that porfolio in Euros. So basically I am constructing a factor-mimicking portfolio.



Then I download the Fama-French Factors from Kenneth French's website. I am planning to run a time-series regression of my portfolio returns on the factors to see whether my portfolio indeed has a exposure to the value factor (I hope so) and/or whether it has exposure to other factors as well. However, the FF factors are generally calculated in USD as far as I understand, so I converted the returns of the factors into € using:


return in € = (1+return in $)*(1+currency_return) - 1


where currency return is E/USD in t divided by E/USD in t-1, minus 1.


If I then run the time-series regression, I get no (significant) exposure to the value factor but significant exposures to the market (positiv), size (negativ, but that's because I filtered out a lot of small stocks I guess), momentum (negativ). So that's weird?!


If I run the time-series regressions with the original factor returns calculated in USD, everything works -- significant positive exposure to HML. No exposure to WML or SMB. But I am pretty sure it's technically incorrect because of the currency issue...




Saturday, June 25, 2016

vector - Fisheye Effect in Inkscape?


Is anyone aware of a way to create a fisheye effect with elements in InkScape? Freehand used to have an xtra tool that did just that.


The specific effect I'm trying to achieve is applying horizontal lines on a spherical object...akin to the latitude marks on globe. If you're staring at the equator, the latitude lines above bend upwards towards the pole and the reverse for those below the equator.


I could do this a number of ways and have some alternatives in mind, but Freehand's Fisheye tool seemed the easiest if there was something similar to that in Inkscape.



Answer



This isn't perfect, but one way is to use the Envelope Deformation path effect.



First convert your object to a path (you have to remove all groups and just end up with one path -- yes this is limiting). Then choose "Path" > "Path Effects Editor...". Select the Envelope Deformation path effect and click "Add". I suggest only enabling top and bottom paths. Then click the icons to edit the top/bottom paths on screen. You can play with them a bit to get the desired effect.


The downside of course is that using path effects necessitates destructive editing and can't be applied to groups of objects.


See this image for an example: example


Should message timestamps be the time the message was sent or the time the server recieved it?


I have a service where messages may be created (and put in a "send" queue) even when there's no connection to the server. When the messages are sent to the server after successfully connecting, should the "message sent time" be set when the server got the message or when it was actually composed by the user?



Answer



Letting the client determine the timestamp seems open to abuse. How do you know the user's clock is set correctly? Gizmodo claims that 1.9% of Android devices are 1 hour fast, and not just for innocuous reasons:



Coin Dozer is styled as an old-style fair/arcade game in which coins are pushed onto a table where they can bump other coins off into a collection tray. The user starts with a finite number of coins, more coins can be won to continue playing, additionally every 30s a coin is generated. If all coins run out by falling off the wrong side, the user must wait for a coin to be generated. This is a cunning technique to encourage users to keep the app open, which will increase ad revenue for the creators.


A cheat was discovered on Android and iOS that involves manually advancing the system clock to fool Coin Dozer and gain coins more rapidly. Since the system time on both iOS and Android is altered by scrolling through numbers, the quickest adjustment is to alter the clock by one hour, one day, or one minute. The cheats generally recommend an hour or a day in order to generate a full complement of coins.




If the messages being sent are in any way time sensitive, can be gamed, or has anything to do with finances, you can only rely on the time the server received the message. If the messages are just harmless bits of text, it may be safe to use the queued time. Just keep in mind that times won't be entirely accurate.


It is worth noting that email clients do not count messages as being "sent" until they have been successfully delivered to the mail server.


adobe photoshop - Select 1px aliased border


When I choose Select > Modify > Border and select a 1px border - the border I get is anti-aliased, hence if I fill my selection a 3px border is affected.


Is there a way to select a 1px aliased border?





Period, or no period, when a text message is displayed on screen


When a user interacts with a button on a website, and the buttons gives some confirmation text to let user know that the action has been performed successfully or unsuccessfully, should there be a period in the text phrase that is displayed?


For example, a user clicks "Save", and there are 3 possible text display scenarios: (assume the text appears in a place easily seen by the user, and that the user needs to know one of the three options)



  1. "Data saved"

  2. "There was no data to save"

  3. "Data was not able to be saved"


-Should there be a period in those messages? Why/why not? I couldn't decide, but I know I want to standardize with one way or the other...Thoughts?





Friday, June 24, 2016

adobe photoshop - Why two identical images forces two different color shade?



So, i have two images CMYK/8 bit to one image I set color #00ade3 to a shape, I then do the same to the other image (also same shape, just bigger) and it forces my color to #04ace3 instead, no way to set the color that I want.


To note that the color I'm trying to set does not receive any warning (gamma) I also noticed that if I set it using C(99) and Y(5) it works and receive the color.


So its not a real problem, I'm just wondering why two identical images behaves differently, maybe there is some setting I don't know?


edit: using Adobe Kuler I noticed something weird: I enter my color #00ADE3 and it gives a CMYK (100,24,0,11) which is a lot darker.




creative writing - How can you humanize infanticide of the evil-tainted?


The world is surrounded by an alternate realm called the spirit world. Humans existed as separate physical entities, but maintain an attachment to the spirit realm due to their connection with god. When a child is ready to be born, it must pass through the spirit world into the physical.


There are malevolent spirits in the other world that seek to corrupt the child while it is developing. Runes are placed on the mother to act as a barrier of protection to prevent this. However, runes must be reapplied periodically and are not foolproof. Therefore, it is possible for a fetus to be affected by these spirits and develop deformities (extra eyes, tentacles for arms, horns, etc). These children can be born prematurely, and risk killing the mother.



These children are not born evil, but are treated with suspicion by the world due to their "impure" taint. In the few places they are tolerated, they exist on the fringes and often become a self fulfilling prophecy. In many other places, such as this democratic nation, they are simply killed after being examined.


Killing children is a taboo, and people reading it may say "author thinks we should kill deformed kids because reasons". How can you portray this in a less negative or at least sympathetic, light to avoid this?




short story - Starting Out - Plot + Charaters by Documentaries



I gues I could say I am decently good at writing, for someone who doesn't write much besides English 101/102 classes.


I have a couple questions, which may proceed some background information to why I am asking the question.






  1. Background: I want to write a fictional story that I thought origanally should be a short since I haven't written a lot of stories; I however, have a lot of storyline and details. The story runs through multiple parts of the main character's life and the beginning part is a lot of background information while the middle and end is where the main story and adventure takes place to the climax of the writing. The begining is supposed to build information and characters that you would not have expected to do be in the story later on.

    Question: Should I write a short story first and then make it into multiple stories like a series of books or a series of short stories? If I take the write a short story route, should I condense the short story into all the stages of the story - young begining, exciting middle and end, or just write a detailed short story about the early years, and expand it to a story with added details into the later life with the main story and plot?... When I say main, I mean like what the story is all about.





  2. Background: I have a lot of details for the plot, characters storyline. I started out with my own main ideas for the main story (which is sort of in the middle where it get's intense) and later on; however, I wanted this preceding story about the characters upbringing. Not to be reduntant, but hoperfully assuring you that I am not copying verbandom someone else's story, I repeat that I got my own ideas for the begining part's setting and character's, but I am using documentary videos of the real grim stories of people's ubringing.

    Question: Should I gather details about the circumstances of the people in these documentaries and the grim cruel cold world they live in and can't escape, and use some of their stories into mine?






  3. Background: Same as in Question 2.

    Question: Regardless of whether should gather details from the documentary, in the case when documentary's (videos articles first person ) are a good sources, should I FIRST know some "writer's secrets" of what details to look for when seekign detial from sources for my stories?




I have some books on Writing and was wondering if read such material would be highly recommended even before grabbing ideas or makeing your own?


My question is should I read such material as cited below, to help me use documentaries and other sources for stories in the most usefull manner ( read description if it helps )?




Answer




should be a short since I haven't written a lot of stories




Forget about that. Making stuff up about word count has no use, except someone pays you for a 1000 word article or a 60.000 words novel. Then you have to meet their criteria. Otherwise just write and count the words after you've finished your story.


I have no clue what your second question is about. Do you ask if you can use documentaries as an inspiration source? Yes, you can. Do you ask if you can steal material? No, you can't.


There are no writer secrets. Have you ever asked a sprinter if there is a secret to running? Probably they just run more often than you. Sit down every day and write. That's it.


Is it good to read about writing? Oh, boy, I could be honest, but you won't like it.


Caution: If you do not want to be discouraged and keep writing instead, leave this post now! (I mean it)


Books about writing contain (more or less) wonderful advice about writing. The problem is, if you haven't written anything of length yet (like your first novel), it's pretty much useless to you.


You will be overwhelmed by all this information and you will not know when to use what and that can be pretty paralyzing. You just lack the experience to use all that stuff correctly.


So my advice is, keep these books on the shelf, write your first novel and when you have gained that experience, read the books about writing.


"Won't that make my first novel worse?" you may ask. Well, it's your first novel. With a 98% likelihood it will be bad anyway, no matter how much you read about writing before. If you are a carpenter's apprentice your first work will not me a master piece, no matter how many books about woodwork you have read. It will be crap. Get over it and start writing.



Oh, and use a spell checker, really.


adobe illustrator - How do I select multiple layers/groups with mouse's dragging?


I have in the workspace some objects. Some are grouped, and are near. I'd like to make a selection of them with click/mouse drag, instead of shift-click selecting each of them (they are somethings like 30 objects, in a small range).


I don't want to make a new group with them.


Is it possible?



Answer



Use the Group Selection Tool and drag around all the objects you want to select


enter image description here



Group Selection tool


Lets you select an object within a group, a single group within multiple groups, or a set of groups within the artwork. Each additional click adds all objects from the next group in the hierarchy.




Source helpx.adobe.com


How to Identify/Change Blue-Bluish Colors in this Map in Photoshop




I want to extract/mark/show all blue colors of the image because there are color blinds who see them as black/wrongly. I need to estimate all blue-bluish colors there and be able to change the color group to some other colors if necessary. I cannot change all bluish colors to something else but need to find some compromise. I heard that you can do it by Photoshop (any edition) but I cannot find a way to do it. Map of Paris


enter image description here




Thursday, June 23, 2016

How to make text on color stand-out?



For example, if I had a dark blue or black background choosing white text will make it stand-out and more readable.


If I had a white or off-white background, black text will stand-out and be readable.


What do I do if the background color is neither dark enough for white to show well nor light enough for black to show well?




validation - What's the best way to alert someone to an error on their form?


When someone submits a form on a Website or mobile app that has an error, what's the best place to show them the error? Should it be by the submit button or by the errant field? If it's by the errant field, should that field zoom into focus?




adobe photoshop - How can I fix this area?


I have just made this in illustrator. I made a path and used gradient across the stroke, but this highlighted area appeared. So, how can I fix it using photoshop or illustrator ?




Answer



It's a fiddly try, but it doesn't look so bad:


1) I copied the horizontal path protruding to the left. You need to know the height of the path (which you can calculate based on the stroke size). Create a rectangle of the same height.



2) Change the width of the rectangle in half.


3) Apply the same gradient to the fill, and clear the outline stroke to 0pt. Use "Linear" and an angle of 90 degrees.


4) Alter the path of the rectangle into a triangle, where the tip would be pointing to the right, down.


5) Copy said triangle, mirror it vertically.


6) Play with the width (50% should do).


Steps in Illustrator


Then adjust your horizontal path in your initial picture, so that it does not overlap with the bow, and take your triangle to cover it. Makes even a nice 3D effect.


Here's a detail of the triangles overlapping the paths, with a black outline:


Detail


A detailed view of the "fiddly joint":



enter image description here


This is a possible final view:


Final


By changing the right side of the triangle into curves, you may make it even look better and more "3d-ish".


labels - When the username is an email address should the field be called 'username' or 'email'?


When the username for a service is an email address should the field be called 'username' or 'email'?



Answer



Call it the email address. It's unambiguous.


A user returning to your service will always remember their email. They may not remember if they configured a special username, however.


adobe photoshop - Align text inside a rectangle.


This may be a silly question...



I'm working with portfolio website. I need to align text inside a rectangle. I drew a box using rectangle tool. I can use my eye and align it vertical and horizontal, but I need to know the perfect way of doing this.


enter image description here



Answer



Select the layers you want to align in the Layers panel and with the Move Tool (V) active, use the align buttons in the top bar. You can also use the menu commands under Layers → Align.


enter image description here


You can read more here: Photoshop Help — Align and distribute layers


tools - How to align objects side by side with a specified distance between them in Illustrator?


I am creating an animated sprite list in Adobe Illustrator. I finished creating the sprites and used the Horizontal/Vertical Distribute Center commands to distribute the objects equally in some area.


But, if the objects are spread too far apart, the Distribute Center tool leaves, albeit equal, much distance between the objects. The opposite is true: if the objects are too close then distributing them will just overlap them.


My question is, is there any tool that just puts objects side by side?



I imagine that this tool would work if the objects aren't even equal in size.


I have viewed this question and answer but it is not what I need.



Answer



You can align to a specific dimension (horizontal or vertical) using the "Distribute Spacing" selection in the "Align" tab.


enter image description here


Select the objects you want to distribute, single-click on one object to set it as the anchor object, and enter the amount you want them distributed. Click on either the distribute vertically or horizontally button.


You can also use this to place two objects exactly next to each other; just set your spacing to "0".


Wednesday, June 22, 2016

Illustrator: how to achieve a wave background letter without stokes



I have a situation. I've created a wave background using the blend tool, I also have a letter on top; not so sure how to fill the letter shape with that wavee background, loosing the letter strokes. enter image description here


what I've done so far:


-Object/Expand the background
-Selected the letter > Create outlines
-Selected the background + The letter shape and using Pathfinder / Outlines I've done this: enter image description here


Now, I've found an option to manually delete the stroke selecting the letter and using Isolate selected group but this will help me to delete each segment of the stroke one by one which is time consuming specially when we have more letters. enter image description here Is there any other method to select the whole letter stroke and delete it automatically? Thanks.



Answer



I think you should use a tool called Clipping Mask


It's easier using the Clipping Mask tool where the letter (A) act like a mask for all objects underneath.


For doing that, make sure to put your letter (A) over the group of wavy strokes and select all artworks, then go to Object > Clipping Mask > Make or just Click CTRL + 7 ... That's it.



enter image description here


enter image description here


as you can see Illustrator will hide the mask strokes and keep it's content only, so you don't have to delete the stroke of the letter (A).


The advantage of this methods is you can change the content of that mask with any other content, in our case the waves could be changes by going to Object > Clipping Mask > Edit Content or released in anytime by going to Object > Clipping Mask > Release or click CTRL + ALT + 7


formatting - Should large numbers be formatted with delimiters?


Every country has a different way of delimiting large numbers. In USA, we put commas between every three digits. For example, one million would appear as 1,000,000. I believe this allows the reader to quickly deduce the magnitude of the number without tediously counting all the digits.


I have seen some prominent websites and apps forgo the delimiters, and thus they lose this benefit. The omission may or may not have been done on purpose. Are there any benefits for omitting delimeters? I would like to hear the standpoints of each side .


Instagram website has delimiters:


Instagram



Instagram iPhone app does not have delimiters::


Instagram




viewpoint - Omniscient but limited Narrator talking to the characters - Pros and cons



It is a third person narrator that changes the character he is "following" from chapter to chapter, or even in the same chapter (just like a limited POV, such as Mistborn or Game of Thrones)


Here are the circumstances:



  • It is a post-apocaliptic book with multiple characters in the same survival clan

  • The narrator "talks" to these characters. So he is "like" a character too.

  • The narrator cannot know what is inside the character's mind unless the character decides to share his thoughts with him (but that character can lie). That's why the narrator is "limited." Depending on how much the character shares his thougts with him, the narrator may use the indirect speech technique.

  • The narrator is trustworthy, but the characters may not be.

  • He does not give his opinion, so the reader can have his own conclusions without the narrator's voice. (But I also have a doubt about this. Can he have a voice without misleading the reader?)

  • I Still dont know who the narrator is (I'm thinking about Death, Spirit or Ghost, but I have my doubts.)



If you want read, here are the reasons I do this:


I do this way in order to make the reader compare the characters and think what is happening inside their heads and their motivations. I will also show informations that many (if not all) characters will not know but the reader does. This will create tension to see how the characters will react to the problem while the reader does not know their interests and motivations. Everything can happen. Because of that mystery behind them, all characters are the chameleon archetype. It's a test of confidence and personality for the reader so he can dive in the story. The reader and the characters will share these same thougts: "can I trust him/her? What she/he is going to do about that? Will the characters work togheter or they will die because of strive for power inside the clan? Will the environment consume the clan or they will survive it?"


What are the pros and cons of these technical features for the narrator? How the relationship of the reader x characters could be affected?




options - How to derive Black-Scholes equation with dividend?



Question: The Black-Scholes equation without dividend is given by $$\frac{\partial V}{\partial t} + \frac{1}{2}\sigma^2S^2\frac{\partial^2 V}{\partial S^2} + rS \frac{\partial V}{\partial S} -rV = 0.$$ (I attempted to derive the equation in my previous post.)


If we assume that 'with dividend rate $D$', then the Black-Scholes equation becomes $$\frac{\partial V}{\partial t} + \frac{1}{2}\sigma^2S^2\frac{\partial^2 V}{\partial S^2} + (r-D)S \frac{\partial V}{\partial S} -rV = 0.$$ How to derive this?



By working backwards and assuming derivation of my previous post, we should have $$d\Pi = \frac{\partial V}{\partial t} dt + \frac{\partial V}{\partial S} dS + \frac{1}{2}\sigma^2S^2\frac{\partial^2 V}{\partial S^2}dt - \Delta S - D\Delta Sdt.$$ But I do not understand why can we add the term in $d\Pi.$



Answer



We assume that the stock price process $\{S_t,\,t>0\}$ satisfies, under the real-world probability measure $P$, an SDE of the form \begin{align*} dS_t=S_t\big((\mu-q)dt+\sigma dW_t\big), \end{align*} where $\{W_t, \, t >0\}$ is a standard Brownian motion. Here, we need to consider the total return asset $e^{qt}S_t$, that is, the asset with the dividend payments invested in the same underlying stock. We consider a locally risk-free self-financing portfolio of the form \begin{align*} \pi_t =\Delta_t^1 \big(e^{qt}S_t\big) + \Delta_t^2 V_t, \end{align*} where $V_t$ is the option price. Then, \begin{align*} d\pi_t &= \Delta_t^1 d\big(e^{qt}S_t\big) + \Delta_t^2 dV_t\\ &= \Delta_t^1 e^{qt}\big(q S_t dt + dS_t \big) + \Delta_t^2\left(\frac{\partial V}{\partial t}dt + \frac{\partial V}{\partial S}dS_t + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 dt\right)\\ &=\left[\mu\Delta_t^1 e^{qt} S_t + \Delta_t^2\left(\frac{\partial V}{\partial t} + (\mu-q) S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 \right)\right]dt \\ &\qquad\qquad\qquad\qquad\qquad\quad + \left(\sigma\Delta_t^1 e^{qt}S_t + \sigma \Delta_t^2 S_t \frac{\partial V}{\partial S}\right)dW_t. \end{align*} Since $\pi_t$ is locally risk-free, we assume that $\pi_t$ earns the risk-free interest rate $r$, that is, \begin{align*} d\pi_t = r \pi_t dt, \end{align*} Then, \begin{align*} &\left[\mu \Delta_t^1 e^{qt} S_t + \Delta_t^2\left(\frac{\partial V}{\partial t} + (\mu-q) S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 \right)\right]dt \\ &\qquad\qquad\qquad\qquad\qquad + \left(\sigma\Delta_t^1 e^{qt} S_t + \sigma \Delta_t^2 S_t \frac{\partial V}{\partial S}\right)dW_t= r \pi_t dt. \end{align*} Consequently, \begin{align*} \sigma\Delta_t^1 e^{qt}S_t + \sigma \Delta_t^2 S_t \frac{\partial V}{\partial S}=0, \tag{1} \end{align*} and \begin{align*} \mu e^{qt} \Delta_t^1 S_t + \Delta_t^2\left(\frac{\partial V}{\partial t} + (\mu-q) S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 \right) = r(\Delta_t^1 e^{qt}S_t + \Delta_t^2 V_t). \end{align*} From $(1)$, \begin{align*} \Delta_t^1 = -e^{-qt} \Delta_t^2 \frac{\partial V}{\partial S}. \end{align*} Then, \begin{align*} -\mu \Delta_t^2 S_t \frac{\partial V}{\partial S}+ \Delta_t^2\left(\frac{\partial V}{\partial t} + (\mu-q) S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 \right) = r\Big(-\Delta_t^2 S_t\frac{\partial V}{\partial S} + \Delta_t^2 V_t\Big), \end{align*} or \begin{align*} \Delta_t^2\left(\frac{\partial V}{\partial t} -q S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2\right) &= r\Delta_t^2\Big(-\frac{\partial V}{\partial S} S_t + V_t\Big). \tag{2} \end{align*} Canceling the term $\Delta_t^2$ from both sides of $(2)$, we obtain the Black–Scholes equation of the form \begin{align*} \frac{\partial V}{\partial t} + (r-q) S_t \frac{\partial V}{\partial S} + \frac{1}{2}\frac{\partial^2 V}{\partial S^2} \sigma^2S_t^2 -rV = 0. \end{align*}



local volatility - Downward sloping smile in normal model


We consider an stock price $S$ following a normal model: $dS_t = \sigma dW_t$


We can write this as $\frac{dS_t}{S_t}=\frac{\sigma}{S_t}dW_t$


Hence we can see that $S$ follows a "log-normal" diffusion with a local volatility function $c(S)=\frac{\sigma}{S}$ which is downward sloping.


My question is: can we deduce that the log normal smile implied by this model will be downward sloping as well ? That is to say, if we have a local volatility function which is decreasing as a function of $S$, will the lognormal implied vol be decreasing as a function of the strike ?


Thanks !



Answer



Since $S_T = S_0 + \sigma W_T$, \begin{align*} C &:= E\left((S_T-K)^+ \right)\\ &= E\left((S_0+\sigma W_T-K)^+ \right)\\ &=\int_{\frac{K-S_0}{\sigma \sqrt{T}}}^{\infty}(S_0+\sigma\sqrt{T} x-K) \frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}dx\\ &=(S_0-K)\Phi\left(\frac{S_0-K}{\sigma \sqrt{T}}\right)+\frac{\sigma\sqrt{T}}{\sqrt{2\pi}}e^{-\frac{(S_0-K)^2}{2\sigma^2 T}}, \end{align*} where $\Phi$ is the cumulative distribution function of a standard normal random variable. Then, \begin{align*} \frac{dC}{d K} &= -\Phi\left(\frac{S_0-K}{\sigma \sqrt{T}}\right) <0. \end{align*} On the other hand, let $\sigma_I(K)$ be the log-normal implied volatility, that is, \begin{align*} C = C(K, \sigma_I(K)). \end{align*} Then \begin{align*} \frac{dC}{d K} &=\frac{\partial C}{\partial K} + \frac{\partial C}{\partial \sigma_I}\frac{\partial \sigma_I}{\partial K}. \end{align*} Here, \begin{align*} \frac{\partial C}{\partial K} = - \Phi(d_2), \end{align*} where \begin{align*} d_2 = \frac{\ln\frac{S_0}{K} - \frac{1}{2}\sigma_I^2 T}{\sigma_I \sqrt{T}}. \end{align*} Since \begin{align*} \lim_{K\rightarrow \infty}\frac{S_0-K}{\ln \frac{S_0}{K}} = \infty, \end{align*} we can expect that, for $K$ sufficiently large, \begin{align*} d_2 > \frac{S_0-K}{\sigma \sqrt{T}}. \end{align*} That is, \begin{align*} \frac{\partial C}{\partial \sigma_I}\frac{\partial \sigma_I}{\partial K} &= \Phi(d_2) - \Phi\left(\frac{S_0-K}{\sigma \sqrt{T}}\right) > 0. \end{align*} Then, \begin{align*} \frac{\partial \sigma_I}{\partial K} > 0, \end{align*} and the implied volatility is a increasing function of such strike levels. In conclusion, the implied volatility does not have to be a decreasing function of the strike.


data - Difference between google finance and yahoo finance?


I am wondering about the huge differences of the data provider google finance and yahoo finance. I am interested in the monthly data from adidas listed on xetra. In google: ETR:ADS and in yahoo finance: ADS.DE - Xetra.


There is a huge difference in the data, e.g. consider the 02.06.2008:


google finance:


Date             Open    High   Low     Close   Volume 
Jun 2, 2008 45.49 45.60 44.93 45.05 1,037,644


yahoo finance (german):


Datum   Eröffnungskurs  Max.    Tief    Schluss Ø Volumen   Adj. Schluss* 
2. Jun 2008 45,49 46,48 39,39 40,11 1.603.100 38,34

As you can see the open ("Eröffnungskurs") is the same. But all other values are different. So currency seems not to be the problem. But why are these values so different?


Also, why is there a yahoo finance gap in August 2008? I don't get the value of the 01.08.2008 but the 18. Aug 2008 instead? Since I am using the yahoo finance data I have to fill in this gap, what value / what method would be appropriate?



Answer



The difference is usually explained by



  • the way the end-providers (Google, Yahoo) aggregate the data they get from their vendors


  • getting prices from same exchange, but from different trading platforms

  • different adjustments and corrections during post trading period

  • missing corporate actions or dividends and many more.


If you have a discrepancy in a price usually it's a good practice to check Investor Relations section on company's website. For example, for Adidas you'd see that the correct value for 6/2/2008 is 45.05.


The ultimate source, of course, would be checking the exchange for that price. If exchange allows to get the price that far back one should use that value. Frankfurt Stock Exchange in this case allows you to get this period. Note that there are two tabs: Xetra and Frankfurt, they simply represent two different trading platforms.


Yahoo, btw, is getting stock data from Hemscott (which was acquired by Mornignstar.) Hemscott is not the most accurate source of EOD stocks. Google is getting the data from SIX Financial (former Telekurs).


gui design - How to make selecting a timezone more user-friendly?


The list of time zones is rather long, lots of duplication, and not very friendly to programmers let alone end-users.



Is there a way to shorten the list to something friendlier and sufficient for 80%+ of users? But then how shall one decide which are the popular Tz?


The list in Windows seems pretty good, but I'm not sure if that's a good list to model after. It is interesting because DST is optional, is that why the list can be that short? Someone worked out the tz equivalents here.


I'm in Pacific Daylight Time (PDT). JS's getTimezoneOffset() returns 420 ==> offset -7. If I use the time zones list above, how would one tell its US/Pacific (-8)?


Furthermore, what are the popular names for time zones? US/Pacific or Canada/Pacific sure sounds friendlier then America/Los_Angeles or America/Vancouver.


Lastly, how are the 2 timezones above different? Can they be safely grouped together and just use America/Los_Angeles in the app? How shall one group time zones together?




tabs - Porting an Iphone app to Android - what are the ActionBar considerations?


we have an iPhone app Design with an designed icon tab bar at the bottom.


enter image description here


For adoption to Android I have a few questions:




  1. Is there a need to put the tabs to the top? Or is it okay to break with Android UI standards sometimes?

  2. Is it okay to still develop with tab bars or would you really suggest using the ActionBar in case of Android? If so, why?

  3. Can we use the bar buttons like they are or do we need a ActionBar with smaller buttons and texts? Do we need a home button etc.?

  4. Is it possible to keep the orange button overlapped - with or without ActionBar?



Answer



Your example could easily converted to ActionBar. I strongly advise anyone porting an iOS app to stick with Android guidelines; it gives better integration to the overall platform. On iOS, it is very common to use tabs as there is a persistent tab bar at the bottom. On Android, we use tabs a little less and hierarchize the importance of toplevel application sections that would belong to the same tab strip on iOS.


I guess one of those tabs is used as "home screen" when the user runs the application. Then, you could have three tabs directly in the action bar: Shop, Stamps and Rewards. The Settings part, since it is less used (do users will use settings as much as other sections?), can be put in the overflow menu.


About the big button with a stamp on it: you could put it at the bottom of the screen whichever tab is active. In addition or in replacement, it is also possible to put the stamp as an action button available in the bar, at it looks like it is a major action that should be called often.


To wrap it up, the action bar may look like this:



[ icon  Shop | Stamps | Reward    | ... ]

st stands for the icon for the quick action, identical tho the round stamp button; ... stands for the overflow menu, behind which you will find the Settings item.


Two additional benefits about using the ActionBar:



  • If there is not enough width to fit all, the tabs will automatically go on a second row.

  • If, on the opposite, the app runs on landscape or tablet and a much wider space is available, the quick action buttons or overflow menu elements can be configured to automatically show text and migrate to the bar depending on how much room is available. You decide the behavior for each button.

  • Programming is much faster. The ActionBar is already there. Bottom tabs would need a separate implementation.

  • And... you just stick to the guidelines and contribute to a consistent experience, which is part of UX quality.



In my opinion: putting iOS-styled tabs on bottom on Android is like putting traffic-light-colored window buttons on the top left of a Windows application frame. It belongs to a different system. I have seen many people today making mobile apps like they do websites, and thinking about such developments like they would do web pages. But, mobile apps are applications, not web pages; they belong to an ecosystem and we all need to keep this in mind.


Tuesday, June 21, 2016

information architecture - Using color in wireframes...is this a "no no"?


Recently, an internal debate was started at work regarding the use of color in wireframes. A junior designer had finished a nice set of wireframes and was told at the end to turn everything into greyscale! They were told that color should not be in wireframes.


I can see a few reasons where designing in greyscale can help:




  • for accessibility (so your not forced to rely on colors for differentiation)

  • not to mistaken communicate visual design in wireframes (sometimes clients may associate a color choice to be a visual design decision as oppose to a way to communicate visual difference)


I actually use a palette of colored icons and will use color to help communicate visual difference. Sometimes there's only so much you can do with using different shades of grey or using patterns.


What is the standard practice out there? I've seen wireframes with and without color.



Answer



Sounds like your colleagues got a little lost in assumptions without thinking about what the purpose of a wireframe is. Let's start with a loose definition provided by Wikipedia:



A website wireframe (also "web wire frame", "web wireframe", "web wireframing") is a basic visual guide used in interface design to suggest the structure of a website and relationships between its pages. A webpage wireframe is a similar illustration of the layout of fundamental elements in the interface. Typically, wireframes are completed before any artwork is developed.




As with any word or term, it's important to consider what it really means. A wire-frame model is a term used in 3D modeling when talking about the representation of the physical structure of a polygonal model, which is rendered by showing connecting points between vertices. What's the point of a wire-frame model? It's to show the "guts" of a structure so as to better understand its composition.


When carried over to website wireframing as Wikipedia discusses it, we should consider how that meaning applies, and Wikipedia's definition nails it: "a basic visual guide used to suggest the structure of a website and relationships between its pages".


As you can tell, there's no mention of colour or how that visual guide should look. All that matters is that it suggests how the structure of the web site works. As long as it achieves that, it's an effective wireframe. So, for instance, these are all "valid" wireframes:



  • sketches on a napkin

  • sketches in 37signals' Draft or some other app on iPad

  • sketchy looking wireframes made using a tool like Balsamiq Mockups

  • tighter looking wireframes made using something like Axure or Illustrator

  • lightweight designs of a site made in Photoshop, where the structure of the page is made apparent while including elements of design where relevant

  • HTML exportable designs in Fireworks that allow you to see what elements a page consists of


  • fully interactive HTML/CSS wireframes


It's just a matter of fidelity and detail. Perhaps you should make clear what kind of fidelity is expected in the deliverable and guide your designers along that path. But it's not a matter of "should color be used in a wireframe" - if color helps communicate the structure of the site, then absolutely color should be used in a wireframe!


fantasy - How to present a human protagonist from a narrator who does not know what a human is?


My protagonist is an average human as we know it in a world populated by different animal-like species. The narrator (different character) is a member of a species that resemble polar bears. As far as the characters (including the narrator and MC) are aware, the MC is the only/first human to have ever existed. Hence the word "human" does not even exist: no one has ever seen anything like him before. The problem is, if the narrator has never seen a human before and does not know what a human is, how would he describe the human MC?


What I have written is simply the narrator pointing out all the differences between the MC and the people of that region:



He was all angles and corners where the rest of us were curved. Even Nuktuk, the runt from a few miles seaward, towered a foot taller than him on his toes. His claws were frail, his canines diminutive, and he had to wrap a length of fur around his head to avoid freezing his oversized ears off. Not to mention his blubber — if it could even be called that — which was so lightly packed that when he shed all those pelts and layers his belly barely bulged at all.



I tried to make it clear that the narrator's comments don't make sense in a human context (claws, blubber, etc) to edge the reader in the direction of thinking, "er, wait, isn't he just normal looking??" But the comments I received said that it wasn't clear to them what species he was.


So my question is: does anyone have any ideas on how to clarify that a character is human without using the word "human"?




market microstructure - What are modern algorithms for trade classification?


When dealing with trade data, for example from TAQ, a common problem is that of determining whether a trade was a buy or a sell. The most commonly used classifier is the Lee-Ready algorithm (Inferring trade direction from intraday data, 1991). Unfortunately, this method is known to be inaccurate: Lee and Radhakrishna (Inferring investor behaviour: evidence from TORQ data, 2000) report that Lee-Ready incorrectly classifies 24% of the trades inside the spread.


How to improve on Lee-Ready's recipie? What are the best algorithms for trade classification?




Which is a good color for a pause button?


We have an application with a built-in stopwatch. If the stopwatch is running the pause button is shown and if it is stopped the play button is shown. Currently the stopwatch itself as well as the button are in neutral colors.


It would be great if the color of the play/pause button could help the user to use the stopwatch more effectivly.


The background needs to stay neutral for technical reasons, so the only design option we have is coloring the button. I've read the discussion about the seperaton of the play and pause button and it makes perfect sense, but again technical reasons prevent me from having two buttons. So, one button on a grey background it is.


Should the running stopwatch with the pause button be green or red?


A green stop button would be a great indicator that the stopwatch is running, but it would be strange to press a green button to stop something. A red stop button would be a great indicator that this is a STOP button, but then the running stopwatch would always show the red button, which is kind of strange.



Answer



ChrisF's answer is very correct - make sure that the colors are not the only indication! Assuming you're already taking care of that:


If the choice is strict between green and red - go for the red.



The button is an action, not an indicator. If it were an indicator you might have wanted it green (to show it's "okay" or running), but when dealing with actions - red means "stop" (and "pause" is a kind of "stop").


Moreover - you don't need further indication that the stopwatch is running - you see the actual numbers change!


BTW - if you have just one button, after you've pressed "pause" what does the button "become"? Will pressing it again resume or stop?


volatility - SKEW and VIX relations?


My question is about the CBOE published index VIX and SKEW.


To start with, I consider working on the variance dynamics. I calibrate the market data (such as VIX and VIX futures) into the Heston model. After that it's not hard to derive the dynamics of VIX.


But how about SKEW, how could I relate the Heston Model to it? Or I shall employ further stochastic models for the higher moments of the underlying log return?




While establishing Heuristics for usability testing,do you advise using your own heuristics or pre defined ones



I am conducting a usability study of medical content delivery systems and I was planning to use some heuristics present in a CHI paper for my Heuristic evaluation.However since the area of focus is slightly different from the paper,I am not sure if all the heuristics are applicable and whether I should use them as a guideline.


How would you handle such a situation,would you create your own heuristics or use an existing one and adapt it to suit your process ?



Answer



An excerpt from Jakob Nielsen's website:



They are called "heuristics" because they are more in the nature of rules of thumb than specific usability guidelines.



Nielsen's heuristics are the most common, but there are definitely other variations. Depending on the application, certain heuristics may apply more than others. It's also possible that a few heuristics were left out from the list you have.


Here's Nielsen's list: http://www.useit.com/papers/heuristic/heuristic_list.html


technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...