Revision of Linear Algebra examples from Mon, 06/18/2012 - 11:43

The revisions let you track differences between multiple versions of a post.

Main Wiki Page | Examples

Break-even analysis

A nice way you understand the value of matrix algebra use it in simple practical examples. One such example is a break even analysis: For instance with certain fixed costs, as well as a pay rate for labour, how many hours do need to charge out in order to break-even?

This can be calculated in an OpenMx model, optimising on profit, and solving with the constraint the we break-even. This model has one free parameter-namely the hours of work.

fit1 = mxModel("fit1",
	mxMatrix(name="hours"        , values=1   , free=T, type="Full", nrow=1, ncol=1),
	mxMatrix(name="fixedCosts"   , values=730 , free=F, type="Full", nrow=1, ncol=1),
	mxMatrix(name="payRate"      , values=5.85 , free=F, type="Full", nrow=1, ncol=1),
	mxMatrix(name="chargeOutRate", values=8.15, free=F, type="Full", nrow=1, ncol=1),
	mxAlgebra(name="revenue"    , expression = chargeOutRate * hours),
	mxAlgebra(name="expenditure", expression = fixedCosts + (payRate * hours)),
	mxAlgebra(name="profit"     , expression = revenue - expenditure),
	mxConstraint(revenue - expenditure ==0, name = "breakEven"),
	mxAlgebraObjective(algebra="profit", numObs= NA, numStats=NA)
)
fit1 = mxRun(fit1)
summary(fit1)

	free parameters:
	  name matrix row col Estimate Std.Error lbound ubound
	1 <NA>  hours   1   1 317.3913        NA              

How much will we lose if we can only charge out 35 hours?

fit1 = mxModel("fit1",
mxMatrix(name="hours" , values=1 , free=T, type="Full", nrow=1, ncol=1),
mxMatrix(name="fixedCosts" , values=730 , free=F, type="Full", nrow=1, ncol=1),
mxMatrix(name="payRate" , values=5.85 , free=F, type="Full", nrow=1, ncol=1),
mxMatrix(name="chargeOutRate", values=8.15, free=F, type="Full", nrow=1, ncol=1),
mxAlgebra(name="revenue" , expression = chargeOutRate * hours),
mxAlgebra(name="expenditure", expression = fixedCosts + (payRate * hours)),
mxAlgebra(name="profit" , expression = revenue - expenditure),
mxConstraint(hours ==35, name = "maxHours"),
mxAlgebraObjective(algebra="profit", numObs= NA, numStats=NA)
)
fit1 = mxRun(fit1)
fit1@algebras$profit@result
[,1]
[1,] -649.5