How to return fitting equation in excel - excel

In excel, I am doing a simple linear regression of two vector X and Y. When I plot X vs Y and fit with linear equation and the result y = kx + b can be shown in the figure. I need to use k and b for my further calculation. I am wondering if there is any equation that can direct return the value of k and b in excel.
Many thanks in advance for he help!

Assuming x values are in A2:A10 and y in B2:B10, your slope (k) with:
=LINEST(B2:B10,A2:A10)
and the intercept (b) with:
=INTERCEPT(B2:B10,A2:A10)

Related

Plotting Number of Events that Occur in an Interval Histogram

In Excel, I have two fields per row, a start date/time and an end date/time. I am looking to plot a histogram that shows how many of the rows' intervals contain the time on the x axis.
For example, some start and end times could be: [1,3], [3,4], [7,9], and [7,8]
And I want an output similar to:
x x x
x x x x x x x
1.2.3.4.5.6.7.8.9
How can this be done?
One way is to split your tuples (say with Text to Columns) into say ColumnsA:B, starting in Row3 (say to Row6) and series filling D1:L9 (or to suit) with D1 = 1 and an integer increase.
Then in D3 copied across to L3 and D3:L3 copied down to Row6:
=IF(AND(D$1>=$A3,D$1<=$B3),"X","")
and in D2 copied across to L2:
=COUNTIF(D3:D6,"X")
Then make a column chart (INSERT > Charts) from D1:L2.
However, I may have misunderstood because there is no particular time significance to the above - the data is just treated like integers.

Excel: Totaling where value is X or Y

I've got an excel spreadsheet where one of the values is X or Y. I want a function to add up the amounts column for all the Xs then the same for all the Ys. So in the example below, the calculation for all Xs would be 1080 and all Ys 1100.
X/Y: Amount
X : 500
Y : 600
X : 580
Y : 500
I'd then like to be able to calculate the mean and median of that figure, so for the mean, take the total of the Xs (1080) and divide by the number of cells with X (2). I don't know how to do this bit either.
Thanks in advance!
So lets assume you have the X and Y in Col A with the values in Col B.
We could use the following formula for the Sum of X:
=SUMIF(A1:A4,"X",B1:B4)
We could use the following formula for the Sum of Y:
=SUMIF(A1:A4,"Y",B1:B4)
As for the Mean we take the above formala and divide by countif like this:
=SUMIF(A1:A4,"X",B1:B4)/COUNTIF(A1:A4,"X")
=SUMIF(A1:A4,"Y",B1:B4)/COUNTIF(A1:A4,"Y")

estimate angle between two lines y = 1000x and y = 999x

How to estimate the angle between line y = 1000 x and y = 999 x?
I use the calculator and get 10^(-6) but how to approximate it by hand. Does it relate to Taylor Expansion?
The slope of the first line is 1000 and that of the second is 999. Simply use the formula
\theta = \arctan\frac{m_1-m_2}{1+m_1m_2},
where m_1 is the slope of 1000 and m_2 is the slope of 999.
You should get an answer of 1.00099×10^{-6} radians.
To use a Taylor-McLaurin series, you should go by https://math.stackexchange.com/questions/348711/maclaurin-series-for-arctanx-by-successive-differentiation, and substitute the value of \frac{m_1-m_2}{1+m_1m_2} for x in each of the successive terms.

combining information that meet criteria in one excel cell

I have to combine data that meet certain criteria. the background is: I have a list with parts for a car that has different model series (in this example X,Y,Z). One partnumber can appear multiple times in the list with different model series. I have to know which part is used in which model series.
for example my existing excel table looks like this:
partnumber Model series
100 X
100 Y
100 X
100 Z
200 Z
200 Y
300 X
400 Y
400 Z
afterwards it should look like this:
partnumber Model series usage
100 X X,Y,Z
100 Y X,Y,Z
100 X X,Y,Z
100 Z X,Y,Z
200 Z Y,Z
200 Y Y,Z
300 X X
400 Y X,Y
400 X X,Y
400 Y X,Y
Is there a formula to do that or do I need VBA? It would be great if I could use a formula for that issue.
thank you very much!
You cannot do this with a regular worksheet formula, but if you include the VBA function from here:
http://www.cpearson.com/excel/stringconcatenation.aspx
Then you can use this formula:
=StringConcat(",", IF($A$2:$A$10=A2,$B$2:$B$10,""))
Where "partnumber" is in A2:A10, "model series" is in B2:B10, and the formula is entered in C2 (using Ctrl+Shift+Enter since it's an array formula) and filled down.

How to do a linear regression in case of incomplete information about output variable

I need to do a linear regression
y <- x1 + x2+ x3 + x4
y is not known
but instead of y we have f(y) which depends on y
for example, y is a probability from 0 to 1 of a binomial distribution over 0, 1
and instead of y we have (the number of 0, the number of 1) out of (the number of 0 + the number of 1) experiments
How should I perform linear regression to find correct y
How should I take into account the amount of information provided that for some x1 x2 x3 we have n experiments which give high confidence value of y, but for other x1 x2 x3 we have low confidence value of y due to small number of measurements
Sounds like you need something like BUGS (Bayes inference Using Gibbs Sampling) for the unknown variable y.
It sounds like you might be asking for logistic regression.

Resources