# Determine logaritmic function based on samples of unique visitors

I need to estimate the unique visitors for any given number of days. I have the unique visitors per day, day, week and month.

 1 day :  20000 visitors
7 days:  85000 visitors
30 days: 200000 visitors


How can I determine a logaritmic function that has these 3 points?

-
A general technique is to take the log of the dependent variable, plot them, and pray it comes out linear. If not, use normal techniques to make a quadratic or cubic. BTW. I see 3 points. – Chris Cudmore Mar 19 '13 at 16:19

## 2 Answers

Logarithmic functions have trouble with $0$, so you will have to exclude that one. I just fed the other three to Excel and found visitors$=51856 \ln t+ 9240$ but it is not a very good fit. Much better is an power law: visitors$=20748t^{0.6806}$

-
Cool, but I need to be able to keep calculating that formula when the numbers change. – Jasny - Arnold Daniels Mar 19 '13 at 16:53

We should expect the unique visitors to grow quickly the first days.

The visitors coming back after a long period is relatively small, but there will always be a group of new visitors. So in the long run the numbers should be almost linear.

This would suggest a logarithmic function like: $$a*log(x+1) + bx$$

Determining a and b this function based on samples is fairly hard. However the function can be approached for $x > 1$ with: $$\sqrt{ax^2+bx}$$

a and b can be calculated using Quadatic regression.

With 3 samples and $y=0$ on $x=0$ the function would not exactly pass through all 3 points, but it'd be a best fit. Taken that we don't really care about $x<1$, the best is to introduce c having the error biggest on $t=0$ and becoming less relevant for a bigger x.

$$\sqrt{ax^2+bx+c}$$

We calculate a, b and c using the discriminant.

$$a = (x3*(y2-y1) + x2*(y1-y3) + x1*(y3-y2)) / ((x1-x2) * (x1-x3) * (x2-x3))$$ $$b = (x3^2(y1-y2) + x1^2(y2-y3) + x2^2*(y3-y1) )/ ((x1-x2) * (x1-x3) * (x2-x3))$$ $$c = (x3*(x2*(x2-x3)*y1 + x1*(x3-x1)*y2) + x1*(x1-x2)*x2*y3) / ((x1-x2) * (x1-x3) * (x2-x3))$$

This answer is courtesy of Nico Schoonderwoerd aka @klup

-
I just scatter plotted the data in Excel, right clicked the graph and added a trendline. It will give you various shapes and print the equation on the graph. If you need the numbers in a subsequent calculation, LINEST or something else is a good choice. – Ross Millikan Mar 19 '13 at 17:12