Further elaboration of exxercises.
This commit is contained in:
parent
93a30acb76
commit
19d4618a53
@ -65,7 +65,6 @@ Note: There is a closed-form expression for
|
||||
$(\hat \beta_0, \hat \beta_1)$. We will not make use of it here, but
|
||||
rather use Julia to solve the problem.
|
||||
|
||||
|
||||
``` julia
|
||||
lm(@formula(Volume ~ Girth), trees)
|
||||
```
|
||||
@ -87,9 +86,12 @@ lm(@formula(Volume ~ Girth), trees)
|
||||
|
||||
- column `Pr(>|t|)`: $p$-values for the hypotheses $\beta_i=0$ for
|
||||
$i=0,1$
|
||||
|
||||
:::callout.tip
|
||||
The command `rand(n)` generates a sample of `n` "random" (i.e., uniformly distributed) random numbers.
|
||||
|
||||
::: callout-tip
|
||||
The command `rand(n)` generates a sample of `n` "random" (i.e.,
|
||||
uniformly distributed) random numbers. If you want to sample from another distribution, use the `Distributions` package, define an object being the distribution of interest, e.g. `d = Normal(0.0, 2.0)` for a normal distribution
|
||||
with mean 0.0 and standard deviation 2.0, and sample `n` times from this
|
||||
distribution by `rand(d, n)`.
|
||||
:::
|
||||
|
||||
**Task 1**: Generate a random set of covariates $\mathbf{x}$. Given
|
||||
@ -234,35 +236,38 @@ $$
|
||||
|
||||
For the models above, these are:
|
||||
|
||||
+----------------+------------------+-----------------+
|
||||
| Type of Data | Distribution | Link Function |
|
||||
| | Family | |
|
||||
+================+==================+=================+
|
||||
| continuous | Normal | identity: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | g(x)=x |
|
||||
| | | $$ |
|
||||
+----------------+------------------+-----------------+
|
||||
| count | Poisson | log: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | g(x) = \log(x) |
|
||||
| | | $$ |
|
||||
+----------------+------------------+-----------------+
|
||||
| binary | Bernoulli | logit: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | g |
|
||||
| | | (x) = \log\left |
|
||||
| | | ( |
|
||||
| | | \ |
|
||||
| | | f |
|
||||
| | | ra |
|
||||
| | | c |
|
||||
| | | {x}{1-x}\right) |
|
||||
| | | $$ |
|
||||
+----------------+------------------+-----------------+
|
||||
+----------------+-----------------+----------------+
|
||||
| Type of Data | Distribution | Link Function |
|
||||
| | Family | |
|
||||
+================+=================+================+
|
||||
| continuous | Normal | identity: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | g(x)=x |
|
||||
| | | $$ |
|
||||
+----------------+-----------------+----------------+
|
||||
| count | Poisson | log: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | |
|
||||
| | | g(x) = \log(x) |
|
||||
| | | $$ |
|
||||
+----------------+-----------------+----------------+
|
||||
| binary | Bernoulli | logit: |
|
||||
| | | |
|
||||
| | | $$ |
|
||||
| | | g |
|
||||
| | | ( |
|
||||
| | | x) = \log\left |
|
||||
| | | ( |
|
||||
| | | \ |
|
||||
| | | f |
|
||||
| | | ra |
|
||||
| | | c |
|
||||
| | | { |
|
||||
| | | x}{1-x}\right) |
|
||||
| | | $$ |
|
||||
+----------------+-----------------+----------------+
|
||||
|
||||
In general, the parameter vector $\beta$ is estimated via maximizing the
|
||||
likelihood, i.e.,
|
||||
@ -296,7 +301,7 @@ model = glm(@formula(participation ~ age^2),
|
||||
::: callout-task
|
||||
**Task 3**:
|
||||
|
||||
1. Reproduce the results of our data analysis of the `tree` data set using
|
||||
a generalized linear model with normal distribution family.
|
||||
2. Generate
|
||||
1. Reproduce the results of our data analysis of the `tree` data set
|
||||
using a generalized linear model with normal distribution family.
|
||||
2. Generate
|
||||
:::
|
||||
|
Loading…
x
Reference in New Issue
Block a user