Me gustaría crear algo como esto para ilustrar modelos lineales. Aquí está mi código hasta ahora, generado con Mathcha, sólo para tener una idea de lo que me gustaría.
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-0.75,xscale=0.75]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Axis 2D [id:dp8361200068338723]
\draw (50,250.04) -- (610.41,250.04)(106.04,11.54) -- (106.04,276.54) (603.41,245.04) -- (610.41,250.04) -- (603.41,255.04) (101.04,18.54) -- (106.04,11.54) -- (111.04,18.54) ;
%Straight Lines [id:da4842290347914763]
\draw [color={rgb, 255:red, 74; green, 144; blue, 226 } ,draw opacity=1 ] (551.41,21.04) -- (44.91,263.54) ;
%Curve Lines [id:da2882365205325442]
\draw [fill={rgb, 255:red, 126; green, 211; blue, 33 } ,fill opacity=1 ] (172,159.74) .. controls (181.41,184.64) and (210.41,154.64) .. (219.41,178.64) .. controls (228.41,202.64) and (197.91,206.64) .. (204.91,226.64) ;
%Curve Lines [id:da35238413522248413]
\draw [fill={rgb, 255:red, 126; green, 211; blue, 33 } ,fill opacity=1 ] (284,107.24) .. controls (293.41,132.14) and (322.41,102.14) .. (331.41,126.14) .. controls (340.41,150.14) and (309.91,154.14) .. (316.91,174.14) ;
%Curve Lines [id:da8161792691558291]
\draw [fill={rgb, 255:red, 126; green, 211; blue, 33 } ,fill opacity=1 ] (403,51.74) .. controls (412.41,76.64) and (441.41,46.64) .. (450.41,70.64) .. controls (459.41,94.64) and (428.91,98.64) .. (435.91,118.64) ;
% Text Node
\draw (112.5,19.4) node [anchor=north west][inner sep=0.75pt] {$y$};
% Text Node
\draw (584,250.9) node [anchor=north west][inner sep=0.75pt] {$z_{1}$};
% Text Node
\draw (538.5,30.9) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize,color={rgb, 255:red, 74; green, 144; blue, 226 } ,opacity=1 ] {$y=\beta _{0} +\beta _{1} z_{1}$};
% Text Node
\draw (537.5,67.74) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize] [align=left] {$\displaystyle \forall z_{i}$ prendo \\valori \textcolor[rgb]{0.49,0.83,0.13}{qui dentro}};
\end{tikzpicture}
Sé cómo generar ejes y líneas en TikZ puro (es decir, sin Mathcha), pero no tengo idea de cómo hacerlo con las campanas gaussianas.
Respuesta1
Como dice Qrrbrbirlbel en los comentarios, solo necesitas plot
la curva gaussiana y shift
ella, rotate
ella y scale
ella, según lo necesites.
Un punto de partida podría ser:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[line cap=round,scale=2]
\coordinate (A) at (-0.5,-0.1);
\draw[-stealth] (-0.5,0) -- (5,0) node[below] {$z_1$};
\draw[-stealth] (0,-0.5) -- (0,3) node[left] {$y$};
\draw[blue] (A) --++ (30:6) node[below right] {$y=\beta_0+\beta_1z_1$};
\node[text width=3cm,right] at (4.7,2) {$\forall z_1$ prendo\\valori \textcolor{green}{qui dentro}};
\foreach\i in {1.5,3,4.5}
\draw[shift={($(A)+(30:\i)$)},scale=0.4,rotate=-60,fill=green] plot[domain=-1.5:1.5,samples=41] (\x,{exp(-2*\x*\x)});
\end{tikzpicture}
\end{document}