3

I snippet of my code is presented here.I do not understand why I'm getting the error undefined control sequence.I have also included the package amsmath.

\subsection{Logistic Regression}
\noindent $p_i=P(y_i=1)$ and $(x_i\in\mathbb{R})^d$. The binary responses are modelled using the following formulation $$\log{{p_{i}}\over{1-p_{i}}}={{\beta}}^{T}{\bf x}_{i}\qquad\text{or}\qquadp_{i}={{\exp({{\beta}}^{T}{\bf x}_{i})}\over{1+\exp({{\beta}}^{T}{\bf x}_{i})}}$$ where $\beta\in\mathbb{R}^d$ are some unknown regression coefficients often estimated using maximum likelihood. 
0

2 Answers 2

4

To use \mathbb, you also need to add amssymb:

enter image description here

In this instance, there seems to be no need for \noindent (unless you modified your sectional headings from the default). Note that I've completely rewritten the mathematical expression:

  • Don't use $$...$$ for your math display; rather use \[...\]. See Why is \[\] preferable to $$$$?;

  • Don't use {<num>}\over{<denom>} for a fraction. Instead, use \frac{<num>}{<denom>};

  • Don't over-use braces; they could change the spacing of elements in the expression.

2

Here is a polished version of your snippet:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb} % for \mathbb

\begin{document}

\subsection{Logistic Regression}

$p_i=P(y_i=1)$ and $(\mathbf{x}_i\in\mathbb{R}^d)$. The binary responses are 
modelled using the following formulation
\[
\log \frac{p_{i}}{1-p_{i}}=\beta^{T}\mathbf{x}_{i}
\qquad\text{or}\qquad
p_{i}=\frac{\exp(\beta^{T}\mathbf{x}_{i})}{1+\exp(\beta^{T}\mathbf{x}_{i})}
\]
where $\beta\in\mathbb{R}^d$ are some unknown regression coefficients often 
estimated using maximum likelihood.

\end{document}

enter image description here

5
  • On the subject of polished looks: Are the parentheses needed in $(\mathbf{x}_i\in\mathbb{R}^d)$? I'm pretty sure they could/should be omitted.
    – Mico
    Jun 27, 2014 at 13:53
  • @Mico I just put the exponent inside the bracket; it denotes a sequence of vectors, I guess.
    – egreg
    Jun 27, 2014 at 13:54
  • I have to admit I've never seen it in text either. I've seen it is displayed math though, as a sort of comment on the variables
    – daleif
    Jun 27, 2014 at 14:06
  • Thinking some more about the case at hand, it may be best to omit the subscript i from \mathbf{x} (I'm pretty sure we're just dealing with a d-element vector, rather than a sequence of vectors...) entirely and to write \exp(\boldsymbol{\beta}^{T}\mathbf{x}). After all, if we're going to use bold for one vector that shows up in an inner product, we might as well use it for both vectors...
    – Mico
    Jun 27, 2014 at 14:13
  • @Mico In the formula \mathbf{x}_{i} is used and it is a d-dimensional vector. I would not enter into a debate about notation: every field is entitled having their own uses. Maybe coherence would require a boldface beta, usage might not. In any case, \boldsymbol is obsolete.
    – egreg
    Jun 27, 2014 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .