Wikipedia:Reference desk/Archives/Mathematics/2007 August 11

= August 11 =

Linear model - Stock Exchange Prediction
In statistics the linear model is given by


 * $$Y = X \beta + \varepsilon$$

where Y is an n×1 column vector of random variables.

I don't get it. What is n? And why the article linear model calls it a column? And what would be the vector in this situation, what kind of random variables? --Savedthat 03:18, 11 August 2007 (UTC)


 * Dude. I'm pretty good at math, but I don't understand this stuff yet. If you don't understand the concept of a random variable, I'm betting that understanding this stuff is going to take a lot of background learning, first.
 * What are you asking all these questions for, anyway? Just wondering... Gscshoyru 03:40, 11 August 2007 (UTC)

It states above "stock exchange prediction"..... --Savedthat 03:44, 11 August 2007 (UTC)


 * Ah. I see. I would suggest taking a probability course, somewhere, if you really want to understand this stuff. Teachers can teach way better than us and wikipedia combined. Gscshoyru 03:51, 11 August 2007 (UTC)


 * Quick answers: if you consider a vector x as (x1, x2, ..., xn), then you can write it as a n x 1 matrix, which looks like a single column from a matrix. n is however many points you're predicting, presumably, and as for what kind of random variables, this would be the most general model possible, so technically any random variable could be used depending on the situation / assumptions. Confusing Manifestation 11:01, 11 August 2007 (UTC)

n is the dimension of whatever you are predicting; or, you can look at it as the number of variables you are predicting. For example if you are using 3 variables to predict two variables, like this:

$$\begin{align} y_1 & = a x_1 + b x_2 + c x_3 + \varepsilon_1 \\ y_2 & = d x_1 + e x_2 + f x_3 + \varepsilon_2 \\ \end{align}$$

you can write it as

$$ \begin{pmatrix} y_1 \\ y_2 \\ \end{pmatrix} = \begin{pmatrix} a & b & c \\ d & e & f \\ \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ \end{pmatrix} + \begin{pmatrix} \varepsilon_1 \\ \varepsilon_2 \\ \end{pmatrix} $$

and then n is 2 and p is 3.

If n is the dimension of whatever you are predicting, how many dimensions are there? --Savedthat 05:25, 13 August 2007 (UTC)

non-linear mapping
What is non-linear mapping or nonlinear mapping? --Savedthat 03:22, 11 August 2007 (UTC)


 * A mapping that is not a linear mapping. --Lambiam 05:51, 11 August 2007 (UTC)

Thanks. --Savedthat 05:24, 13 August 2007 (UTC)


 * The simplest nonlinear functions are polynomials. The next class would be analytic functions. Based on you question, it is difficult to offer more references for you. twma 00:15, 14 August 2007 (UTC)

Movie Prediction Systems
You may have heard of Yahoo! Movies Recommendations, and Netflix Recommendations, and IMDB recommendations. So how does a Movie Prediction System work? --Savedthat 03:26, 11 August 2007 (UTC)


 * I am no expert ... but I believe that they make your future predictions based on your past experiences. On NetFlix, for example, you rate all of the films that you have seen (on a 5-star scale).  Using this data (what films in the past I have liked versus not liked), NetFlix will generate film predictions (what films in the future I will like versus not like).  They are making inferences based on data from your past reported experiences.  Mathematically, I am sure they have some complex algorithm to calculate all of this.  But, conceptually, I believe it is as I have above described.  (Joseph A. Spadaro 03:38, 11 August 2007 (UTC))


 * Yes but I want to know more about the mathematics behind it... --Savedthat 03:45, 11 August 2007 (UTC)


 * Collect films which are similar in some way, say categories A, B, and C. If you watched and rated a film in category A highly, they may recommend highly another film in category A. It most likely wouldn't be very complicated -- the complication lies in creating the categories, and that is where humans come in.


 * I have to believe that it is more complicated than the post immediately above has described. Of course, there are categories: say, Drama, Comedy, Horror, Westerns, etc. etc. etc.  And, of course, these services have lists of films that are categorized as such.  If I like comedies, all I need to do is look at the list of comedies to select another comedy.  I don't need the Prediction System to do that for me.  And, if it were indeed that simple, NetFlix (or whoever) would simply say "You like Comedy films.  Take a look at our list of Comedies by clicking here."  And that would be that.  So, I am sure it is more complex than that -- otherwise, why would they bother?  (Joseph A. Spadaro 04:54, 11 August 2007 (UTC))


 * Having multiple categories such as genre, author, actors, year produced, director, etc, doesn't necessarily make the algorithm more complicated. One can assign weightings to categories to favor some categories over others, but that's not a very complex change.


 * I don't know how they work, but one technique I can think of is comparing the films you like with the films other people like and finding people with similar tastes to your own. So the system looks at what films you like, then it looks for other people who liked those films, and suggests films that a large percentage of those other people also liked. So suppose you liked the film Ocean's Eleven (2001 film), the system thinks, "Hmm, a lot of people who liked Ocean's Eleven also liked Confidence (film), I'll recommend that." This is what what Amazon.com appears to do. Maelin (Talk | Contribs) 05:15, 11 August 2007 (UTC)

(decrease indent) I don't know how they work either, but this is what I might do if I was commissioned to produce such a system. Netflix or whoever has all this data provided by its customers. First I'd regrade the ratings of each customer "along the curve", so that different customers have comparable distributions of their ratings. Using a method like principal components analysis, I'd find a relatively low-dimensional space in which the movies can be projected so that the ratings can be explained by customer preferences. Basically, movies and customers alike are represented as vectors in this space, and the expected customer rating of a movie is the inner product of their vectors. The vectors have been chosen to give results that are as close as possible to the known customer ratings (or at least preserving the ranking order), and should have some predictive value for movies that are new to the customer. Once the system is in place and these vectors have been computed, it should be possible to use new data to nudge the vectors in the right direction rather than recompute everything. PCA is based on a linear model, which makes this computationally quite tractable, but if necessary the same idea can be applied to more elaborate models (for instance, where a fan of gore may start finding a movie too gory). --Lambiam 05:51, 11 August 2007 (UTC)


 * If I understand you correctly, you don't need to generate potential ratings -- although you could, but that's not what was being asked -- just recommend to the customer something which he or she might like based on previous purchases and ratings.


 * By using the term "complex" in my response above, I did not necessarily mean that the mathematics per se was complex. In fact, it is probably not.  Most likely it is simply collecting some pertinent data and taking a mean average.  Very simple math indeed.  By "complex", I meant that the mathematical algorithm (simple as it is) is composed of many variables.  "They" (e.g., NetFlix) examine and collect the following types of data to make their predictions:  my past film experiences through the ratings I assign films; my personal ratings of which genres/categories I like versus I do not like; demographics such as my age and gender and geographic location; the degree to which I individually am similar to or dissimilar to all other members in the database; etc.  They determine which other database members are "similar" to me ... which films those similar database members prefer ... and then recommend such films to me.  (Joseph A. Spadaro 16:38, 11 August 2007 (UTC))

Quite coincidentally, even as we speak, NetFlix is running a contest to try to improve their Film Prediction algorithms. See: http://www.netflixprize.com/. (Joseph A. Spadaro 16:46, 11 August 2007 (UTC))

Thanks. --Savedthat 05:24, 13 August 2007 (UTC)

havent done calculus in like a year
(d/dy)(e^x) = (dx/dy)(e^x) right? added by User:Froth

No

$$\left ( \frac{d}{dy} \right ) e^x=0$$

the rule is

$$ \left ( \frac{d}{dx} \right ) e^u = \left ( \frac{du}{dx} \right ) e^u$$

where u is a stand-in for an expression, in this case we have u=x, so:

$$ \left ( \frac{d}{dx} \right ) e^x = \left ( \frac{dx}{dx} \right ) e^x=(1)e^x=e^x $$

--Cronholm144 17:51, 11 August 2007 (UTC)
 * I think the last line should read (d/dx)(e^x)= (dy/dx)(e^x)= e^x. Tesseran 17:55, 11 August 2007 (UTC)


 * No, there isn't a y in the expression. I think your thinking of the chain rule, which I have added above. --Cronholm144 18:12, 11 August 2007 (UTC)


 * I think there is :X --18:47, 11 August 2007 (UTC)


 * Well I thought d/dy of (e^x) would be (e^x)*x' because of the chain rule. How can it be 0 since e^x changes through x? That wouldn't make any sense --⁪frotht 18:29, 11 August 2007 (UTC)
 * I saw this on another page:

y = e^x d/dy y = d/dy e^x dy/dy = e^x dx/dy 1 = e^x dx/dy dx/dy = 1 / e^x
 * Which would seem to confirm what I said originally, especially as you can just reciprocol both sides of the familar dy/dx = e^x and work backwards to dy/dy = e^x dx/dy --⁪frotht 18:47, 11 August 2007 (UTC)


 * (after umpteen edit conflicts) If "Cronholm's rule"
 * (d/dx)(e^u) = (du/dx)(e^u)
 * is correct (and I think it is), then so is Froth's original
 * (d/dy)(e^x) = (dx/dy)(e^x)
 * by the simple change of variables (x,u) := (y,x). If x does not depend on y, then dx/dy = 0. --Lambiam 18:49, 11 August 2007 (UTC)


 * Interesting, you're saying that since this "y" i just pulled out of thin air for "d/dy" doesn't exist, there's no change in e^x over y so it's 0. And I guess that would explain the tangled self-reference loopy math I quoted above, since you have to set y actually equal to what you're differentiating. Thanks --⁪frotht 18:55, 11 August 2007 (UTC)


 * (conflict)All that (forum)post is saying is that d(whatever)/d(whatever)=1. For your question, it all depends on what y's relation to x is. In your original post you didn't mention that you wanted y=e^x. --Cronholm144 18:53, 11 August 2007 (UTC)


 * I didn't, but it helped me understand what was going on --⁪frotht 18:55, 11 August 2007 (UTC)


 * And I don't think that's really what it's saying- you might as well say that proves 1=1 or x*0=0 or x*1=x.. I can't really put my finger on what's generally going on though, it's spinning my mind in circles -_- --⁪frotht 18:57, 11 August 2007 (UTC)


 * Cronholm I still don't get your 3rd equation in that top reply. It's not d/dx it's d/dy, which is why it's =0.. why did you go off and prove (dx/dx)=1? --⁪frotht 19:00, 11 August 2007 (UTC)
 * I thought you had just mistyped your question. BTW if your having trouble, just do the very inappropriate(for reason I don't feel like going into) "flip" of both sides of the last equation in your box, you'll see that we have arrived my 3rd equation(assuming y=e^x)--Cronholm144 19:02, 11 August 2007 (UTC)
 * dy = (e^x)dx? What's the problem? --⁪frotht 19:50, 11 August 2007 (UTC)


 * I see too many equations and too few concepts. Let's (briefly) review.
 * We seek the derivative of a function. The function takes in a real number and produces a real number. The derivative at a specific value is a scale factor, the ratio of change in output to change in input. If the output of one function is the input to another, the composite scale factor is the product of that for each function.
 * The awkwardness in the question and answers has little to do with these concepts, and more to do with names and notations.
 * When we see ex, the assumption is that we have an unnamed function,
 * $$ x \mapsto e^x . \,\!$$
 * Here the x can be replaced by any name, so long as it is replaced everywhere on both sides, and so long as the new name does not conflict with existing names.
 * When we see d&frasl;dy, ordinarily the assumption is that the name of the variable used in the function is y. More specifically, when we see
 * $$ \frac{d}{dy} e^x, \,\!$$
 * we assume that x and y are two unrelated quantities, unless told otherwise. We do not assume that ex is a function named y. We do not assume that x depends on y.
 * If y is the name of the function, then the result is 1 (and the expression was written badly).
 * If x depends on y, then the result is ex·dx&frasl;dy (and a remark indicating the dependency is customary).
 * If x is unrelated to y, then the result is 0 (which is the default assumption).
 * The exponential is already a function with a conventional name.
 * $$\begin{align}

\exp \colon \R &{}\to \R \\ x &{}\mapsto e^x \end{align}$$
 * And we have a slightly different notation using "differentials" instead of "derivatives".
 * $$ d \exp(u) = \exp(u) \, du \,\!$$
 * The clever part of this is that we can (pretend to) divide by dx, creating a derivative.
 * $$ \frac{d}{dx} \exp(u) = \exp(u) \, \frac{du}{dx} $$
 * Ordinarily the assumption is that u is some unspecified function of x. But if u is unrelated to x, then du&frasl;dx is zero (a change in x has no effect on u). Differentials are convenient, but they depend on hidden connections and must be used with care. --KSmrqT 21:19, 11 August 2007 (UTC)
 * The answer above is very good and explains the things that I didn't want to mention for fear of inducing confusion.--Cronholm144 05:15, 12 August 2007 (UTC)
 * We can see from the signature that the answer above is by KSmrq; stating that it is very good is redundant. -- Meni Rosenfeld (talk) 14:51, 12 August 2007 (UTC)
 * :) indeed —Cronholm144 18:22, 12 August 2007 (UTC)

Principal components analysis
How do I input the values from the article Principal components analysis to Microsoft Excel, so it does the calculation for me? Let's take the variables from one of Friday's most actively traded stock: http://finance.google.com/finance?q=NASDAQ:SUNW --Savedthat 19:46, 11 August 2007 (UTC)


 * Okay... Maybe you should consider cooling your enthusiasm down a bit? Predicting change in stock prices is not a simple problem, and you should probably wait until you have more background before you try to deal with it. Apperantly, you have become so obsessed with the problem that you see connections to it when none exist. Let it rest for now; Come back to it in a few years. -- Meni Rosenfeld (talk) 21:40, 11 August 2007 (UTC)


 * There are ways of anticipating trends in stock prices (if someone invents a new whizzbang gadget that includes a chip from Company X, Company X's stock price may rise), but nothing that is completely foolproof or completely algorithmic is going to be simple, just like Meni says.