Skip to content

Commit

Permalink
update read me
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami-Leon committed Mar 23, 2024
1 parent 42fbdbb commit d42f395
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions R/posi.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ debias_plmm <- function(x, y, series, plmm_output, a = 1, Z = NULL) {
y_a <- Sigma_a_sqrt_inv %*% y_offset

if (is.null(Z)) {
de_sparsified <- hdi::lasso.proj(x_a, y_a,
de_sparsified <- suppressMessages(hdi::lasso.proj(x_a, y_a,
suppress.grouptesting = TRUE, return.Z = TRUE,
do.ZnZ = TRUE, betainit = "scaled lasso"
)
))

debias_score_matrix <- de_sparsified$Z
} else {
Expand Down
6 changes: 4 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ plmm_output <- plmm_lasso(x, y, series, t,
gamma = gamma, lambda = lambda, timexgroup = TRUE,
criterion = "BIC"
)
plmm_output$lasso_output$theta
```

With a larger lasso penalty more coefficients are set to zero. The coefficients associated to the nonlinear functions are alpha.
With a larger lasso penalty more coefficients are set to zero.
The coefficients associated to the nonlinear functions are alpha.
```{r}
head(plmm_output$lasso_output$alpha)
```
Expand All @@ -102,7 +104,7 @@ tuned_plmm <- tune_plmm(x, y, series, t,
```


The function tuned_plmm tries every possible combination of the values from lambdas and gamma and returns the model with the best BIC. This example is for illustration only and typicaly wider and finer grid should be used.
The function tuned_plmm tries every possible combination of the values from lambdas and gamma and returns the model with the best BIC. This example is for illustration only, in practice a more exhaustive grid should be used.

### Plotting the results
The function plot_fit allows for the vizualisation of the estimated mean trajectories as well as the estimate of the nonlinear functions. By default only the observed time points are being used, to use predicted time points the argument predicted can be set to TRUE.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ plmm_output <- plmm_lasso(x, y, series, t,
gamma = gamma, lambda = lambda, timexgroup = TRUE,
criterion = "BIC"
)
plmm_output$lasso_output$theta
#> Intercept group x1 x2 x3 x4 x5
#> 3.5544003 0.4262652 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
```

With a larger lasso penalty more coefficients are set to zero. The
Expand Down Expand Up @@ -114,7 +117,7 @@ tuned_plmm <- tune_plmm(x, y, series, t,

The function tuned_plmm tries every possible combination of the values
from lambdas and gamma and returns the model with the best BIC. This
example is for illustration only and typicaly wider and finer grid
example is for illustration only, in practice a more exhaustive grid
should be used.

### Plotting the results
Expand Down Expand Up @@ -144,9 +147,6 @@ used.

``` r
debias_plmm(x, y, series, tuned_plmm)
#> Nodewise regressions will be computed as no argument Z was provided.
#> You can store Z to avoid the majority of the computation next time around.
#> Z only depends on the design matrix x.
#> Estimate Debiased Std. Error Lower 95% Upper 95% p-value
#> group 3.20441442 3.31447827 0.33608394 2.65575376 3.9732028 6.079223e-23
#> x1 1.95569696 2.03694234 0.21339004 1.61869786 2.4551868 1.352832e-21
Expand Down
7 changes: 0 additions & 7 deletions man/tune_plmm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d42f395

Please sign in to comment.