1

So, I am attempting to use pgflots to draw a sketch of a one-independent variable linear probability model in the form of the equation I have below, which shows the implied relationship between E(Yj) and X1j.

Equations below

Now, I have developed a sketch of what I want (see picture below), but have been unable to replicate it. The closest thing to helping me out has been the following post: Non-linear curve fitting with gnuplot. However, it really has proven difficult for me to translate that code into the sketch I want below (labels and everything). Help is deeply appreciated!

Sketch I want to produce in LaTeX

ealfons1
  • 259
  • Could you post what you've got so far, and specify what exactly you're struggling with? – Jake Nov 01 '12 at 22:29
  • I was just playing around with the code from the post I referred to in my question. It was yielding some really strange results. However, the answer below is pretty much what I wanted. I will get to working on labeling it as I have on my sketch above. – ealfons1 Nov 01 '12 at 23:24

1 Answers1

4

I did something similar for my phd thesis. Here's a minimal example:

enter image description here

\documentclass{article}
\usepackage[latin1]{inputenc}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
    [% options
    xlabel=$x$,
    ylabel={$x$},
    axis x line = middle,
    axis y line = left,
    xmin=0,
    xmax=20,
    ymin=-1.7,
    ymax=1.2,   
    ]
\addplot[
    domain=0:20,    
    samples=30,
    line width = 2pt,
    ] 
    {(1/(1+exp(-1*(x-8))))};    
\addplot[
    domain=0:20,    
    samples=30,
    dashed,
    ] 
    {x/4 - 1.5};    
\addplot[
    domain=0:20,    
    samples=30,
    dashed,
    ] 
    {1};        
\end{axis}
\end{tikzpicture}
\end{document}

Here's the math:

enter image description here

I think you can use this as a start.

If you just want to have straight lines segments (instead of a function like in my example) then you can use the domain option to restict the visability of every plot.