\section{Introduction}

Deep, near-infrared $K$-band ($2.2\mu$m) galaxy surveys are a powerful tool for
studying galaxy evolution, eg. Gardner, Cowie \& Wainscoat \shortcite{gcw93},
Cowie et al.\ \shortcite{cghshw94}, Glazebrook et al.\ \shortcite{gpmc95}.
Compared to blue-optical light, near-infrared light is a better tracer
of mass in evolved stars and the correction for redshift
dimming (the ``$k$-correction'') is approximately independent of
morphological type.
The rapid evolution in galaxy number counts apparent in the $b_J$ band is not
seen in the $K$ band, eg. Koo \& Kron \shortcite{kk92}.
However, it is vital to have a reliable determination of the $K$-band
luminosity function (LF) for {\em nearby} galaxies in order to interpret
faint galaxy counts and to calculate the clustering of $K$-selected galaxy
samples.
Local $K$-band luminosity functions have been measured from optically-selected
samples by Mobasher, Sharples \& Ellis \shortcite{mse93} and 
Szokoly et al. \shortcite{sscm98}
and from $K$-selected samples by Glazebrook et al.\ \shortcite{gpmc95} and
Gardner et al. \shortcite{gsfc97}.
Since all of these surveys are flux-limited, the majority of galaxies have
$K$-band luminosities close to $L_K^*$.
Even in the largest sample (Gardner et al., 510 galaxies), it was
feasible to measure the LF over a range
of only 5 magnitudes, ${M^*}^{+3}_{-2}$, and so the the faint-end slope of 
the $K$-band luminosity function, so important for predicting galaxy number 
counts, is still rather poorly constrained.

In this paper we present a new estimate of the $K$-band LF over a range
of ten magnitudes, ${M^*}^{+8}_{-2}$, based on a subsample of galaxies
selected from the Stromlo-APM galaxy survey \cite{lpme96}.
This survey is an ideal source
for estimating the $K$-band LF since redshifts have already
been measured for 1797 galaxies with $b_J < 17.15$
over a very large volume of space.
The solid angle of the survey is 1.3 sr and the median redshift is
about 15,300 km/s.
The key to measuring the faint-end of the $K$-band LF without a huge
investment of telescope time is to observe galaxies selected by their
intrinsic luminosity rather than their apparent flux.
One can make use of the fact that near-infrared and optical
luminosities are correlated \cite{mes86,sci96}, 
in order to preferentially select galaxies of high and low luminosity and
thus sample the luminosity range more uniformly than a flux-limited sample.
One is thus able to measure the luminosity function to fainter
luminosities than from a flux-limited sample of similar size.
This sampling strategy is described in \S\ref{sec:sample} and
the observations and data reduction are discussed in \S\ref{sec:obs}.
Our method of estimating $\phi(M_K)$ from a $b_J$-selected sample is given
in \S\ref{sec:method} and we test this method in \S\ref{sec:test}.
Our results are presented in \S\ref{sec:results} and we conclude in
\S\ref{sec:concs}.
For notational convenience, we will denote absolute magnitudes 
in the $K$ and $b_J$ bands by $M_K$ and $M_B$ respectively.
Throughout, we assume a Hubble constant of $H_0 = 100$ km/s/Mpc.

\section{Sample Selection} \label{sec:sample}

The aim in selecting a subset of Stromlo-APM galaxies for which to obtain
$K$-band photometry was to sample the magnitude range 
$-22 \le M_B \le -13$ (the full range of $b_J$ absolute magnitudes
in the Stromlo-APM survey) as uniformly as possible.
An added complication in defining the sample arose because we wished
to obtain optical CCD images for the same sample of galaxies.
One planned use of this optical imaging is to measure morphological
parameters for a representative sample of galaxies at low redshift 
in order to compare with HST observations of galaxies
at high redshift, $z > 0.4$, \cite{brinch98}.
To obtain comparable linear resolution to the HST data required observing
galaxies at $z < 0.04$, assuming ground-based seeing of 1.3 arcsecond.
Our primary sample thus consists of galaxies at redshifts $z < 0.04$.
We divided the magnitude interval $-22 \le M_B \le -13$ into 90 bins
each of width 0.1 mag.
We then randomly selected up to six galaxies from the Stromlo-APM survey with
$z < 0.04$ in each bin.
Due to the redshift limit of $z < 0.04$, this primary sample
contains rather few galaxies brighter than $M_B = -20$.
We therefore formed a supplementary sample, consisting of galaxies at
$z > 0.04$ to top up each magnitude bin, where possible,
to six galaxies.
This supplementary sample consists entirely of galaxies with $M_B < -20$.
The primary sample contains 283 galaxies, and the supplementary sample
contains 80 galaxies, giving a total sample size of 363 galaxies.

\section{Observations and data reduction} \label{sec:obs}

Imaging of the above sample of galaxies was carried out at the
Cerro Tololo Interamerican Observatory (CTIO) 1.5m telescope using
the CIRIM infrared array through the standard $K$ filter
over the nine nights 1996 August 31 -- September 4 and 1997 October 19--22.
The pixel size at $f/7.5$ is $1.16''$, allowing most galaxies
to be observed at 9 non-overlapping positions on the $256 \times 256$ array.
Two frames were taken with the galaxy at the central position, 
thus yielding 10 frames per galaxy.
Total integration time for each galaxy was 300 seconds.
For 11 galaxies with angular size more than 100 arcsec,
we obtained four on-source and four offset-sky integrations of 75 seconds each.
In the following, these will be referred to as ``biggrid'' observations.
Standard stars were observed from the list of Elias et al.\ \shortcite{efmn82}.
Dark frames and dome flats were taken at the start of each night.

The infrafred frames were reduced using {\sc iraf}, 
mosaiced with the {\sc dimsum}\footnote{{\sc dimsum} is the Deep Infrared 
Mosaicing Software package developed by
Peter Eisenhardt, Mark Dickinson, Adam Stanford, and John Ward, and is
available via ftp from
ftp://iraf.noao.edu/iraf/contrib/dimsumV2/dimsum.tar.Z} package and 
image detection and photometry was performed using SExtractor \cite{ba96}.

\subsection{Basic reduction}

The basic reduction process consisted of the following steps:
\begin{enumerate}
\item Non-linearity correction using the {\sc irlincor} task with parameters
$c1 = 0.9997$, $c2 = 0.0257$, $c3 = 0.0158$ (Mike Keane, private communication),
\item Subtraction of dark frame,
\item Flatfielding by dome flat,
\item Masking of bad pixels.
\end{enumerate}

\subsection{Mosaicing}

At this stage of the reduction we had ten frames per galaxy, with the galaxy
at a different position on each frame.
Mosaicing of the frames and subtraction of sky background was performed
using the {\sc dimsum} package.
As described by Stanford, Eisenhardt \& Dickinson \shortcite{sed95},
{\sc dimsum} employs a two-pass procedure in order to mask out faint as
well as bright images when constructing the sky background, 
resulting in a much flatter sky than is obtained from median filtering of 
the galaxy frames with outlier rejection.
Individual galaxy frames were block replicated by a factor
of 4 in each dimension, allowing alignment to be performed by integer offsets
without interpolation.
Co-added images and corresponding exposure weight maps were made by
summing the aligned images and were finally block averaged $2 \times 2$ 
in order to economize on disc space.

For the 11 ``biggrid'' observations, the four offset sky frames were median 
filtered with outlier rejection in order to estimate the sky background.
The sky background was subtracted from each of the four on-source frames,
which were then aligned and coadded.

\subsection{Image detection and photometry}

We used SExtractor 2.0.15 to detect and measure images in the mosaiced frames.
For both standard stars and galaxies we used the {\sc mag\_best} estimate
of magnitude.
This yields a pseudo-total magnitude \cite{kron80} except in crowded fields,
when a corrected isophotal magnitude is measured instead.
Magnitude errors were estimated by combining in quadrature SExtractor's
estimate of the error from photon statistics and the difference between
magnitudes measured using local and global estimates of the sky background.
Of the selected sample of 363 galaxies, 351 were observed under photometric
conditions and 345 yielded a
$K$-band magnitude with an estimated error of less than 0.1 mag 
(rms mag error = 0.04 mag).

\subsection{Calibration}

Since we observed only single band infrared imaging, we used the following 
simple relation to convert observed magnitudes $k$ to standard CIT
\cite{efmn82} magnitudes $K$:
\begin{equation}
K = k + k_0 + k_X X, \label{eqn:trans}
\end{equation}
where $k_0$ is a zero-point offset, $k_X$ is the extinction coefficient in
the $K$-band and $X$ is the airmass of the observation.
We made a total of 74 standard star observations during the runs
(an average of 8 per night) and we initially
fitted the parameters $k_0$ and $k_X$ for all standard star observations
combined, obtaining $k_0 = 7.588 \pm 0.020$ and $k_X = 0.081 \pm 0.018$
with rms residual magnitude error of 0.018.
Six standard star observations with large residuals were omitted from the
fitting procedure, three of these were from the night of 1996 August 31,
which was partially non-photometric.
Holding the zero-point term fixed at $k_0 = 7.588$ we then fitted the
extinction coefficient separately for each night, with results shown
in Table~\ref{tab:calib}.
Galaxy magnitudes were converted to the CIT system using (\ref{eqn:trans})
with $k_0 = 7.588$ and $k_X$ coefficients from the Table.
Galaxies observed during non-photometric conditions on the nights of 
1996 August 31 and 1997 October 20 were rejected: these cases were obvious 
from the rapidly varying sky background.

\begin{table}
 \caption{Standard star calibration data.}
 \label{tab:calib}
 \begin{tabular}{lrrcc}
 \hline
 \hline
 Night & $N_{\rm std}^1$ & $N_{\rm del}^2$ & $k_X^3$ & rms\\
 \hline
1996 Aug 31 & 11 & 3 & $0.105 \pm 0.006$ & 0.017\\
1996 Sep 01 &  4 & 1 & $0.101 \pm 0.002$ & 0.003\\
1996 Sep 02 &  9 & 0 & $0.081 \pm 0.004$ & 0.014\\
1996 Sep 03 &  9 & 0 & $0.082 \pm 0.004$ & 0.015\\
1996 Sep 04 &  7 & 0 & $0.092 \pm 0.004$ & 0.011\\
1997 Oct 19 &  9 & 0 & $0.083 \pm 0.003$ & 0.010\\
1997 Oct 20 &  7 & 1 & $0.067 \pm 0.004$ & 0.010\\
1997 Oct 21 & 11 & 1 & $0.075 \pm 0.002$ & 0.007\\
1997 Oct 22 &  7 & 0 & $0.066 \pm 0.005$ & 0.013\\
  \hline
  \hline
 \end{tabular}

 \medskip
 $^1$ Number of standard stars observed.\\
 $^2$ Number of outliers deleted.\\
 $^3$ Extinction coefficient in (\ref{eqn:trans}).
\end{table}

\subsection{Photometric repeatability}

\begin{figure}
\centerline{\psfig{figure=repeats.eps,width=\linewidth}}
\caption{Repeatability of galaxy photometry.
The top panel plots the rms $K$ magnitude between repeated observations
against $K$ magnitude from the coadded data.
The symbols indicate the rms magnitude error and the length of
the line shows the estimated magnitude error.
The lower panel plots the same information but as a function of mean
$K$-band surface brightness $\mu_K$ within the measurement aperture.
Open symbols denote sources deblended by SExtractor, stars indicate a 
``biggrid'' observation.
\label{fig:repeats}}
\end{figure}

Thirty-one galaxies, mostly of low $K$-band surface brightness, were observed 
on more than one occasion, which allows us to assess the repeatability of
our photometry.
In these cases, we ran SExtractor on the mosaiced galaxy frames both before
and after coadding observations.
We obtain final photometry from the coadded frame and use 
the two individual frames and the coadded frame to estimate the rms error.
In four cases, one observation was made using ``biggrid'': in these cases
we do not coadd the observations and instead use the {\sc dimsum}-reduced 
observation for the final magnitude and estimated error.

In Figure~\ref{fig:repeats} we plot both our estimated errors and the rms
errors between repeated observations as a function of $K$ magnitude and mean
surface brightness $\mu_K$.
The symbols indicate the rms magnitude error and the length of
the line shows the estimated magnitude error from the coadded image.
Thus if our estimated errors are a good estimate of the true rms then the lower
ends of the error bars should reach zero.
In most cases, the rms error is within 2--3 times the estimated error 
and in a few cases the error is slightly overestimated.
The five points with rms $> 0.4$ all correspond to images which were broken
up by SExtractor's deblender (open symbols).
We attempted to sum the flux from the components, but clearly the
$K$ magnitude for these objects is accurate to only $\sim 0.5$ mag.
We see that most of the discrepant points are of extremely low surface 
brightness, $\mu_K \ga 21.5$ mag arcsec$^{-2}$.
For unbroken images, all rms errors are less than 0.2 mag and the estimated
errors provide a reasonable estimate of the rms.
The stars denote objects in which one of the observations used separate
sky exposures (``biggrid'' observations).
For two out of four of these objects, we see an rms magnitude error larger
than 0.1 but with a negligible estimated error (from the non-biggrid 
observation).
The reason for this is the poorer sky subtraction of the biggrid observations
compared with the {\sc dimsum} reduction of the majority of our observations.

\subsection{Matching to APM}

Since the mosaiced frames cover an area of sky around 8 arcmin on a side,
albeit not to uniform depth, they provide $K$-band photometry for
many objects in each field in addition to the target galaxy.
We therefore matched the images detected by SExtractor with images in the
APM scans.
Using the matched objects in each frame, we calculated a 6-parameter transform 
from CIRIM pixel coordinates to APM plate coordinates and thence to RA \& Dec.

The $K$-band photometry for the target galaxies is presented in the Appendix
to this paper.

\subsection{Sample properties}

\begin{figure}
\centerline{\psfig{figure=ksel.eps,width=\linewidth}}
\caption{Illustration of observational selection effects in our sample.
The upper panel plots observed $b_j - K$ colour versus apparent $K$ magnitude.
The line shows the apparent magnitude limit for the Stromlo-APM survey, 
$b_J = 17.15$.
The lower panel plots redshift against apparent $K$ magnitude.
The line in this case separates the primary and supplementary samples
at $z = 0.04$.}
\label{fig:ksel}
\end{figure}

Since our source survey is limited by $b_J$ flux, our $K$-band sample is
not a complete one, as illustrated in Figure~\ref{fig:ksel}.
At faint $K$ magnitudes, only blue objects will be in the Stromlo-APM sample.
We are roughly complete to $K \approx 12$, the bluest galaxies can be seen
as faint as $K \approx 15$.
The luminosity function estimator described in \S\ref{sec:method} corrects
for this $K$-band incompleteness and allows us to use all galaxies with 
$K$-band photometry.
In the lower panel of this Figure we plot the redshift distribution as
a function of apparent $K$ magnitude.
The requirement that $z < 0.04$ for the primary sample has a noticeable
effect on the overall redshift distribution: this effect is also accounted
for by our luminosity function estimator.

\begin{figure}
\centerline{\psfig{figure=colmag.eps,width=\linewidth,angle=-90}}
\caption{Rest-frame $M_B - M_K$ versus $M_k$ colour-magnitude plot.
	Plus signs represent early-type galaxies, asterisks late-type
	galaxies and dots represent unclassified galaxies.
	The solid line shows a least-squares fit to all galaxies, 
	the dashed line a fit to early types and the dot-dashed line a fit
	to late type galaxies.}
\label{fig:colmag}
\end{figure}

To calculate absolute magnitudes we use galactocentric recession velocities
and assume k-corrections in the $b_J$ band as given in Table~2 of
Efstathiou, Ellis \& Peterson \shortcite{eep88}.
We assume a $K$-band k-correction of $-2.5 z$ for all galaxy types
(ie. the near-infrared k-correction {\em brightens} galaxies with redshift).
This is a very good approximation to the $K$-band k-correction of
Glazebrook et al.\ \shortcite{gpmc95} for redshifts $z < 0.15$.

Figure~\ref{fig:colmag} shows the rest-frame $(M_B - M_K)$ versus $M_K$
colour-magnitude relation for our data.
The fit to all galaxies is given by
\begin{equation}
(M_B - M_K) = -0.212 \times M_K - 1.20,\ \sigma = 0.77. \label{eqn:colmag}
\end{equation}
The slopes in this relation for early and late-type galaxies
($-0.135 \pm 0.036$ and $-0.209 \pm 0.024$ respectively) are consistent
with those found for E-S0 ($-0.095 \pm 0.013$) and Sa-Sdm ($-0.24 \pm 0.03$)
galaxies by Mobasher, Ellis \& Sharples \shortcite{mes86}, although we find a
significantly larger scatter about the relation.
At least part of this scatter is due to saturated APM $b_J$ magnitudes 
for galaxies $b_J \la 15$ and a few instances of the APM scans breaking up a 
very large, bright galaxy into fragments.
An improved colour-magnitude relation will be available when we incorporate
optical CCD magnitudes for these galaxies (Loveday \& Lilly, in preparation).

\section{Estimating the $K$-Band Luminosity Function}
\label{sec:method}

When one has a sample selected on optical $b_J$ magnitude and wishes to 
estimate the $K$-band luminosity function,
the best way to proceed is to calculate a bivariate luminosity function 
(BLF, $\phi(M_K, M_B)$) allowing for known selection in $b_J$ flux and $M_B$ absolute
magnitude and then to integrate over $M_B$ to obtain $\phi(M_K)$.
One can estimate the shape of $\phi(M_K, M_B)$,
independently of inhomogeneities in the galaxy distribution, using
the maximum likelihood method of Sandage, Tammann \& Yahil \shortcite{sty79}.
The probability of seeing a galaxy with $K$-band luminosity $L_K^i$
and $B$ band luminosity $L_B^i$ at redshift $z_i$ in our sample is given by
\begin{equation}
p_i = \frac{\phi(L_K^i, L_B^i) S(L_B^i)}
      {\int_{{L_K}_{\rm min}(z_i)}^{{L_K}_{\rm max}(z_i)}
      \int_{{L_B}_{\rm min}(z_i)}^{{L_B}_{\rm max}(z_i)}
      \phi(L_K, L_B) S(L_B) dL_K dL_B}.
\end{equation}
The function $S(L_B)$ accounts for the known selection in absolute $B$ 
magnitude and the luminosity limits ${L_B}_{\rm min}(z_i)$ and 
${L_B}_{\rm max}(z_i)$
are the minimum and maximum $B$-band luminosities observable at
redshift $z_i$ in a sample limited by apparent $b$ magnitude.
For the sample analysed here, there are no flux limits in the $k$-band,
and so the integral over $K$-band luminosity runs from 
0 to $+\infty$.
The maximum-likelihood shape of the BLF $\phi(M_K, M_B)$ is estimated by maximizing
the likelihood ${\cal L} = \prod_{i=1}^{N_g} p_i$ (the product of the 
individual probabilities $p_i$ for the $N_g$ galaxies in the sample) 
with respect to the parameters describing the BLF.


In practice, we do not have a good {\em a priori} parametric model for 
$\phi(M_K, M_B)$, and so instead we measure $\phi(M_K, M_B)$\
in a non-parametric way using an extension of the Efstathiou, Ellis \& Peterson
\shortcite{eep88} stepwise maximum likelihood (SWML) method.
Sodr\'{e} \& Lahav \shortcite{sl93} have extended the SWML method to estimate
the bivariate diameter-luminosity function and to allow for sample 
incompleteness.
We adopt their extension of the SWML estimator here, including the sampling
function $S(M_B)$ separately for the primary and supplementary galaxy samples.
These sampling functions are illustrated in Figure~\ref{fig:samp}, which shows 
histograms of $M_B$ for the entire Stromlo-APM sample, for the selected 
galaxies with good $K$-band photometry and the sampling functions $S(M_B)$.

\begin{figure}
\centerline{\psfig{figure=samp.eps,width=\linewidth}}
\caption{Sample selection as a function of $M_B$ absolute magnitude for the
primary (thick lines) and supplementary (thin lines) samples.
The upper panel shows histograms of $M_B$ for all 1797 galaxies in the
Stromlo-APM survey.
The middle panel shows the same for the 345 selected galaxies with $K$-band 
photometry.
The lower panel shows the sampling functions $S(M_B)$, the ratio of selected
to total galaxies in each bin.}
\label{fig:samp}
\end{figure}

We measure the bivariate luminosity function in bins of absolute
$K$ and $B$ magnitude,
\begin{equation}
\phi(M_K, M_B) = \phi_{jk},\ \ j = 1, \ldots, N_{M_K},\ \ k = 1, \ldots, N_{M_B},
\end{equation}
where $M_K^j - \Delta M_K/2 < M_K < M_K^j + \Delta M_K/2$ and
$M_B^k - \Delta M_B/2 < M_B < M_B^k + \Delta M_B/2$.

The log-likelihood is given by
\begin{eqnarray}
\ln{\cal L} & = & \sum_{i=1}^{N_g} \sum_{j=1}^{N_{M_K}} \sum_{k=1}^{N_{M_B}}
	      W_{ijk} \ln[\phi_{jk} S(M_B^k)] - \nonumber \\
	      & & \sum_{i=1}^{N_g} \ln\left[
	      \sum_{j=1}^{N_{M_K}} \sum_{k=1}^{N_{M_B}}
	      H_{ijk} \phi_{jk} \right] + {\rm const}.
\label{eqn:logL}
\end{eqnarray}
Here $W_{ijk} \equiv W(M_K^i - M_K^j,\ M_B^i - M_B^k)$, with,
\begin{equation}
W(x,y) = \left\{ \begin{array}{ll}
		1 & \mbox{if} -\Delta M_K/2 \le x \le \Delta M_K/2\\
		  & \mbox{and} -\Delta M_B/2 \le y \le \Delta M_B/2,\\
			0 & \mbox{otherwise.}
		    \end{array}
	    \right.
\end{equation}
The sampling function $S(M_B)$ (Fig.~\ref{fig:samp})
is incorporated into the ramp function $H$.
Writing $M_K^- = M_K^j - \Delta M_K/2$,\ $M_K^+ = M_K^j + \Delta M_K/2$,\ 
$M_B^- = M_B^k - \Delta M_B/2$,\ and $M_B^+ = M_B^k + \Delta M_B/2$, then
\begin{equation}
H_{ijk} = \frac{1}{\Delta M_K \Delta M_B} \int_{M_K^-}^{M_K'} dM_K
	  \int_{M_B^-}^{M_B'} S(M_B) dM_B,
\end{equation}
where $M_K' = \max[M_K^-, \min(M_K^+, {M_K}_{\rm lim}^i)]$ and
$M_B' = \max[M_B^-, \min(M_B^+, {M_B}_{\rm lim}^i)]$.

To fix the otherwise arbitrary normalisation constant we apply the constraint
\begin{equation}
g = \sum_j \sum_k \phi_{jk} \left(\frac{L_K}{L_f}\frac{L_B}{L_f}\right)^\beta
    \Delta M_K \Delta M_B - 1 = 0
\end{equation}
with $\beta = 1.5$ and the fiducial luminosity $L_f$ corresponding to 
$M = -20$ using a Lagrangian multiplier $\lambda$.
The new likelihood $\ln {\cal L'} = \ln {\cal L} + \lambda g$ is maximised
with respect to the $\phi_{jk}$ and $\lambda$, requiring that $\lambda = 0$.

Setting $\partial\ln{\cal L'}/\partial\phi_{jk} = 0$, one arrives
at a maximum likelihood estimate for $\phi_{jk}$,
\begin{equation}
\phi_{jk} = n_{jk}\left/\sum_i^{N_g}\left[
	    \frac{H_{ijk} \Delta M_K \Delta M_B}
	    {\left(\sum_{l=1}^{N_{M_K}} \sum_{m=1}^{N_{M_B}} \phi_{lm} H_{ilm} 
	    \Delta M_K \Delta M_B \right)} \right] \right.,
\label{eqn:phiKB}
\end{equation}
where $n_{jk} = \sum_{i=1}^{N_g} W_{ijk}$ is the number of galaxies
in the $(j,k)th$ bin.
Errors in $\phi_{jk}$ are estimated via the inverse of the information matrix
(Efstathiou et al.\ 1988).

As with all density-independent estimators, information about the overall
normalisation is lost.
We therefore normalise our BLF to the mean density of galaxies with 
$-22 \le M_B \le -13$ in the full Stromlo-APM sample, 
$\bar{n} = 0.071 h^3{\rm Mpc}^{-3}$, calculated as described by Loveday et al.\
\shortcite{lpem92}.
(Note that the density $\bar{n} = 0.047 h^3{\rm Mpc}^{-3}$ quoted by 
Loveday et al.\ (1992) is for the restricted magnitude range 
$-22 \le M_B \le -15$.)

Finally, we obtain the $K$-band luminosity function by summing over
$B$ magnitude bins,
\begin{equation}
\phi(M_K^j) = \sum_{k=1}^{N_{M_B}} \phi_{jk}.
\label{eqn:phiK}
\end{equation}
One can then fit a given functional form, eg. a Schechter \shortcite{schec76}
function, to the stepwise estimate by least-squares.

\section{Test of the Method} \label{sec:test}

We have tested the above procedure by using it to
estimate the $K$-band luminosity function from a set of Monte Carlo 
simulations.
We generated nine mock Stromlo surveys by a Soneira \& Peebles \shortcite{sp78}
hierarchical clustering simulation with similar clustering properties to that
measured from the Stromlo-APM Survey \cite{lmep95}.
Each galaxy in the simulation was assigned a $K$-band luminosity 
drawn at random from
a Schechter function with $\alpha = -1.20$ and $M_K^* = -23.6$
and then assigned a $b_J$ magnitude according to our observed
colour-luminosity relation (\ref{eqn:colmag}).
Galaxies were selected on their apparent $b_J$ magnitude, $b_J < 17.15$.
This process was repeated until each simulation contained 2000 galaxies.
We then sampled each simulation by absolute $M_B$ magnitude as described
in \S\ref{sec:sample}, finally yielding an average of 359 galaxies
per simulation.
We calculated the K-band luminosity function $\phi(M_K)$ for each
simulation as described in \S\ref{sec:method} and fit a Schechter function
to each by least squares.
Averaging over the nine simulations, and estimating the BLF in bins of width
0.5 mag, we measure mean and rms Schechter
function parameters $\alpha = -1.17 \pm 0.07$, $M^* = -23.6 \pm 0.2$.
The errors on the mean values are $\sqrt 9$ times smaller than the quoted
rms scatter between the simulations.
Our estimates of $\alpha$ and $M^*$ are in excellent agreement with the
input luminosity function.

\begin{figure}
\centerline{\psfig{figure=test.eps,width=\linewidth}}
\caption{Test of our method to estimate the $K$-band luminosity function 
from $b_J$-limited samples.
The upper panels show the $K$-band LF estimated from each of nine 
Soneira-Peebles simulations and the lower panel shows the mean and rms
(error bars offset to right).
In each case the curve shows the {\em input} LF.
\label{fig:test}}
\end{figure}

The SWML estimates of the $K$-band LF for the simulations
are shown in Figure~\ref{fig:test}.
The points show the SWML estimate of $\phi(M_K)$ from
the nine simulations and the curve shows the input Schechter function with
shape $\alpha = -1.20$, $M^*_K = -23.6$.
The error bars going through the data points show the errors determined
from the covariance matrix.
The lower panel shows the average over the 9 simulations.
The rms scatter between realisations for each data point (shown by
the error bars offset slightly to the right) are in satisfactory agreement 
with the predicted errors.

Overall, we find that our procedure for estimating $\phi(M_K)$ from a
sample limited by apparent $b$ magnitude and further selected by absolute
$B$ magnitude provides a robust and unbiased estimate of the 
$K$-band LF over a wide range of absolute magnitudes.

\section{Results} \label{sec:results}

\begin{figure*}
\centerline{\psfig{figure=klf.eps,width=12cm,angle=-90}}
\caption{The $K$-band luminosity function estimated from our sample
(symbols) together with the best-fit Schechter function.
The inset shows the 1 and 2 $\sigma$ likelihood contours for the shape 
parameters $\alpha$ and $M_K^*$.}
\label{fig:klf}
\end{figure*}

Our estimated $K$-band luminosity function is shown in 
Figure~\ref{fig:klf}.
The curve shows a Schechter function fit to the SWML estimate using least
squares.
We allow for finite bin width by calculating the mean predicted 
$\langle \phi_j \rangle$ at the absolute magnitude of each galaxy in each bin, 
rather than simply calculating $\phi(M)$ at the bin centre.
The inset shows 1 and 2 $\sigma$ likelihood contours for the shape parameters
$\alpha$ and $M_K^*$, where the normalisation $\phi^*$ is adjusted to maximize 
the likelihood at each grid point.
The best-fit Schechter parameters are $\alpha = -1.16 \pm 0.19$, 
$M_K^* = -23.58 \pm 0.42$ and
$\phi^* = 0.0121  \pm 0.0082 h^3 {\rm Mpc}^{-3}$.
The quoted errors on $\alpha$ and $M_K^*$ come from the bounding-box of the 
1$\sigma$ likelihood contour.

Clearly the characteristic magnitude $M_K^*$ is rather poorly constrained
from these data, and so in order to measure the faint-end slope $\alpha$
independent of $M_K^*$, we have also fit a straight line to our estimated LF
over the restricted luminosity range $M > -22$.
We measure a slope $-1.08 \pm 0.15$, consistent with that measured
from the Schechter fit.
Furthermore, this slope does not change significantly varying the bright 
luminosity cut from $-20.5$ to $-23$.

Since we normalised the LF to the same number density as the full Stromlo-APM
sample, the error in $\phi^*$
is dominated by the uncertainty in shape of the LF.
The Schechter function provides a reasonable fit to the SWML estimate over the
full range of ten magnitudes; there is no indication of any faint-end turnup.

\begin{figure*}
\centerline{\psfig{figure=comp.eps,width=15cm,angle=-90}}
\caption{Comparison of our new estimate of the $K$-band luminosity function
(dotted line) with estimates from (a) Mobasher et al., (b) Glazebrook et al.,
(c) Gardner et al.\ and (d) Szokoly et al.}
\label{fig:comp}
\end{figure*}

\begin{table*}
\begin{minipage}{12cm}
 \begin{center}
 \caption{Schechter function fits to $K$-band LFs.}
 \label{tab:comp}
 \begin{math}
 \begin{array}{lccc}
 \hline
 \hline
 {\rm Sample} & \alpha & M^*_K & \phi^* / h^{-3}{\rm Mpc}^3\\
 \hline
\mbox{Mobasher et al.\ 1993} & -1.0 \pm 0.3 & -23.4 \pm 0.3 & 0.0112 \pm 0.0016\\
\mbox{Glazebrook et al.\ 1995 ($z < 0.2$)} & -1.04 \pm 0.31 & -23.02 \pm 0.23 & 0.029 \pm 0.007\\
\mbox{Gardner et al.\ 1997} & -0.91 \pm 0.24 & -23.12 \pm 0.17 & 0.0166\\
\mbox{Szokoly et al.\ 1998} & -1.3 \pm 0.2 & -23.6 \pm 0.3 & 0.012 \pm 0.004\\
\mbox{This work (all galaxies)} & -1.16 \pm 0.19 & -23.58 \pm 0.42 & 0.012 \pm 0.008\\
\mbox{This work (non-ELG)} & -1.3 \pm 0.4 & -23.5 \pm 0.7 & 0.001 \pm 0.001\\
\mbox{This work (ELG)} & -1.2 \pm 0.4 & -22.5 \pm 0.8 & 0.011 \pm 0.013\\
  \hline
  \hline
 \end{array}
 \end{math}
\end{center}
\end{minipage}
\end{table*}

In Figure~\ref{fig:comp} and Table~\ref{tab:comp}, we compare our new estimate
of the $K$-band luminosity function with those of other workers.
Following Glazebrook et al.\ (1995) and Gardner et al.\ (1997), we have added 
0.22 mag to the points from Figure~2 of Mobasher et al.\ (1993) to account for
their method of calculating K-corrections.
We have also applied an aperture correction of $-0.30$ mag to the 
Glazebrook et al.\ data (see Gardner et al.\ 1997).
Ours is the first estimate of $\phi(M_K)$ fainter than $M_K = -20$.
Brighter than this all estimates are in reasonable agreement,
particularly given the uncertainties in the normalisation of the LF from
small samples of galaxies.
The normalisation of the Glazebrook et al.\ (1995) sample is about twice
that of all the other samples.
This is likely to be due to sampling fluctuations, since their survey covers
only 552 arcmin$^2$ and contains a total of only 124 galaxies.

Note that the bright-end points of our estimated LF have dropped significantly
since the preliminary analysis of Loveday \shortcite{love98car}.
This is largely due to the improved K-band photometry obtained by mosaiccing
the galaxy frames with {\sc dimsum} compared with a cruder algorithm used
earlier.

\subsection{ELG versus non-ELG}

As an aid to understanding the processes of galaxy formation and 
evolution, it is of great help 
to have estimates of the luminosity function for different types of galaxies.
The most objective way of separating Stromlo-APM galaxies is via the equivalent
width of the \mbox{H$\alpha$}\ emission line \cite[hereafter LTM]{ltm99}.
Due to the small size of our $K$-band sample, we subdivide into just two 
subsamples, those with $\mbox{EW\,(H$\alpha$)} < 10$\AA\ (non-ELG, 138 galaxies) and those with 
$\mbox{EW\,(H$\alpha$)} \ge 10$\AA\ (ELG, 134 galaxies).
For the remaining 71 galaxies, no \mbox{EW\,(H$\alpha$)}\ measurement is available (LTM).
For both subsamples we recalculated the sampling function $S(M_B)$ appropriate
for galaxies with \mbox{EW\,(H$\alpha$)}\ less or greater than 10\AA\ as appropriate.
The LFs were normalised to mean densities of $\bar{n} = 0.018\ h^{3}{\rm Mpc}^{-3}$
(non-ELG) and $\bar{n} = 0.098\ h^{3}{\rm Mpc}^{-3}$ (ELG) as determined for galaxies
with these emission line properties from the full Stromlo-APM sample.
The fact that the estimated mean density of ELGs is larger than that for
galaxies of any \mbox{EW\,(H$\alpha$)}\ ($\bar{n} = 0.071 h^{3}{\rm Mpc}^{-3}$, cf. \S\ref{sec:method})
is a consequence of the mean density of subsamples of Stromlo-APM galaxies
being determined to only $\sim 30\%$ accuracy (LTM).

\begin{figure}
\centerline{\psfig{figure=ew.eps,width=\linewidth,angle=-90}}
\caption{Comparison of the $K$-band luminosity function estimated from our 
non-ELG sample (filled symbols, continuous line) and ELG sample (open symbols,
dashed line).}
\label{fig:ew}
\end{figure}
\begin{figure}
\centerline{\psfig{figure=ew_like.eps,width=\linewidth,angle=-90}}
\caption{$1\sigma$ likelihood contours for the best fit Schechter parameters
for the non-ELG and ELG samples.}
\label{fig:ew_like}
\end{figure}

The estimated LFs for each subsample are shown in Figure~\ref{fig:ew}
and the $1\sigma$ likelihood contours for the best fit Schechter parameters
are shown in Figure~\ref{fig:ew_like}.
The Schechter function parameters themselves are listed in Table~\ref{tab:comp}.
Compared with the optical luminosity functions for \mbox{EW\,(H$\alpha$)}-selected samples (LTM),
the $K$-band LFs for ELGs and non-ELGs are very similar in shape,
with just a $\sim 1\sigma$ indication that ELGs have characteristic magnitudes
$M^*$ about one magnitude fainter than non-ELGs.
Note that the faint-end slopes for the two samples are completely consistent.
These results are in accord with the LFs estimated for E/S0 and spiral 
galaxies by Mobasher et al.\ (1993).

\section{Conclusions} \label{sec:concs}

We have presented a new estimate of the $K$-band luminosity
function obtained from infrared array imaging of a subsample of galaxies
from the Stromlo-APM survey.
We measure $\phi(M_K)$ over a range of 10 magnitudes, ${M^*}^{+8}_{-2}$, 
a significantly greater range of luminosities than has been measured before now.
Our LF is consistent with earlier estimates, and shows that a
Schechter function of moderate faint-end slope ($\alpha = -1.16$) provides
a good fit to the LF as faint as $M^* + 8$ with no hint of any upturn
at the faint-end.
This observation appears to rule out the suggestion of Glazebrook et al.\ 
(1995) that there may be an extra dwarf component to the $K$-band LF, or
at least that if there is such a component, it must have characteristic 
magnitude $M_{\rm dwarf} \ga M^*_K + 8$.
In contrast, the faint-end upturn seen in the field $b_J$ LF \cite{love97}
is apparent by $M^*_B + 6$, and in the CfA Redshift Survey \cite{mhg94} by
$M^*_{Zw} + 3$.
In the Coma cluster, an upturn in the $H$-band
($1.6\mu m$) LF is also seen at $M^*_H + 3$ \cite{desd98}.
Note that we do see a slight upturn in $\phi(M_K)$ near $M^*_K + 3$,
faintward of the three low points around $M_K = -22$, but the LF flattens
out again by $M_K = -20$.

The $K$-band LFs for non-ELGs and ELGs are very similar in shape, with no
difference in faint-end slopes, contrary to what is seen in the optical LF 
(LTM).
The steep optical LF for ELGs might be consistent with a $\sim$ flat mass 
function in a fading burst model \cite{hp97}, 
although the particular model that Hogg \& Phinney consider
would steepen the $K$-band LF even more than the optical LF.

The main limitation with our sample is that the $b_J$ selection of the
source survey introduces a bias against red galaxies compared to a
$K$-selected sample.
However, the good agreement between the $K$-band LFs determined from $K$
and $b_J$-limited samples in Fig.~\ref{fig:comp} suggests that our
$b_J$ selection does not significantly affect the estimated $K$-band LF.
In particular, it is unlikely that we are underestimating the faint-end slope
of the $K$-band LF since red galaxies tend to be luminous in $K$
\cite{mes86,sci96}.
We will further address the issue of colour selection in a future paper 
in which we plan to parameterize the bivariate LF
$\phi(M_K,M_B)$ using CCD $b_J$ magnitudes in addition to the $K$-band data
presented here.

\section*{Acknowledgments}

It is a pleasure to thank George Efstathiou for suggesting this project,
the CTIO staff for their excellent support, and Bahram Mobasher, Jon Gardner,
Karl Glazebrook and Gyula Szokoly for sending me their $K$-band LF data points.


