Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f67a85
commit ce771d9
Showing
54 changed files
with
1,619 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
Package: lmvar | ||
Type: Package | ||
Title: Linear Regression with Non-Constant Variances | ||
Version: 1.3.0 | ||
Version: 1.4.0 | ||
Author: Posthuma Partners <info@posthuma-partners.nl> | ||
Maintainer: Marco Nijmeijer <nijmeijer@posthuma-partners.nl> | ||
Description: Runs a linear regression in which both the expected value and the variance can vary per observation. The expected values mu follows the standard linear model mu = X_mu * beta_mu. The standard deviation sigma follows the model log(sigma) = X_sigma * beta_sigma. The package comes with two vignettes: 'Intro' gives an introduction, 'Math' gives mathematical details. | ||
License: GPL-3 | ||
LazyData: TRUE | ||
Imports: Matrix (>= 1.2-4), matrixcalc (>= 1.0-3), maxLik (>= 1.3-4), | ||
stats (>= 3.2.5), parallel (>= 3.4.0), graphics (>= 3.4.0) | ||
stats (>= 3.2.5), parallel (>= 3.3.0), graphics (>= 3.3.0) | ||
RoxygenNote: 6.0.1 | ||
Suggests: testthat, knitr, rmarkdown, R.rsp, MASS | ||
Suggests: testthat, knitr, rmarkdown, R.rsp, MASS, plotly (>= 4.7.1) | ||
VignetteBuilder: knitr, R.rsp | ||
ByteCompile: true | ||
NeedsCompilation: no | ||
Packaged: 2017-09-07 16:38:03 UTC; Marc | ||
Packaged: 2018-01-04 13:15:42 UTC; Marc | ||
Repository: CRAN | ||
Date/Publication: 2017-09-07 16:57:40 UTC | ||
Date/Publication: 2018-01-04 13:35:36 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,96 @@ | ||
8529d3ad0081124a394bb527ee4f4002 *DESCRIPTION | ||
d7b3b055a54ec3ea20025d0d9ec537f2 *NAMESPACE | ||
20f3d086eea94d6f505070c1c5bdba97 *NEWS.md | ||
737c7276afc455e1dc45ee0571f89b17 *DESCRIPTION | ||
ce7a76cdaa2b45d08bc84e9f85c5feb6 *NAMESPACE | ||
b7e04f28dbe98a892a02db51d24d750a *NEWS.md | ||
799ae591e93eb076cea0d9f8150235dd *R/AIC.lmvar.R | ||
b0137d370c4c1a01bc5ceb87d8cc6285 *R/alias.lmvar.R | ||
625dea541a0b4657fa96a308a8ba0f3a *R/alias.lmvar_no_fit.R | ||
c5a11e9f3431dd97d7e32a2df0f1fbd5 *R/beta_sigma_names.R | ||
6d527a34b60bbee5b434a3eb19b542a3 *R/coef.lmvar.R | ||
718d994f7b143739b6ef42c943db24ec *R/cv.lm.R | ||
949c597b1db808d95f31a63c802f49c7 *R/cv.lmvar.R | ||
e2a1a06a401c6301a201079f420b545c *R/dfree.R | ||
c5c198f98bd106402ae117a72346cd07 *R/cv.lm.R | ||
0583283b0f91b74fa71e2bde980aab20 *R/cv.lmvar.R | ||
fea491c24e8358a662f33f78cd943b36 *R/dfree.R | ||
39b90ad72cc9880282de9bf614d68133 *R/examples/AIC_examples.R | ||
bd9d7d3681defffd188f22a59df22c77 *R/examples/alias_examples.R | ||
cea578f43b0272013134f25920d8124e *R/examples/alias_examples.R | ||
13fa82f04c348bab1ab18187053eea3b *R/examples/beta_sigma_names_examples.R | ||
c5ae01de2d2f10f7b4bfa919e3f388a6 *R/examples/coef_examples.R | ||
e0010ebeb1c03a095f66a011ba8bb36d *R/examples/cv.lm_examples.R | ||
d7a1f1991629cf6020d032e75506be65 *R/examples/cv.lmvar_examples.R | ||
9d526fd9bc9b4c72c55cc5cd2614b4fa *R/examples/dfree_examples.R | ||
e90ab449ca7d486b0105fad6c21ba426 *R/examples/dfree_examples.R | ||
dd73ddf4aff15db9a6a6407af1a59577 *R/examples/fisher_examples.R | ||
de72e46ee5d6f79ef95e6546a123fe54 *R/examples/fitted_examples.R | ||
7b44ee3e2f417ae8f7b9c360962cba82 *R/examples/fwbw.lm_examples.R | ||
a39b7511472835d2a3d644b080897516 *R/examples/fwbw.lmvar_examples.R | ||
d3855d9578a0c082419605bc766848f8 *R/examples/fwbw.lmvar_no_fit_examples.R | ||
3c50a595183a1e9cc4caec85108ce44d *R/examples/lmvar_examples.R | ||
ad51d20e3090296a1e5f343be95f3f6b *R/examples/lmvar_no_fit_examples.R | ||
e93509e8f18367eae4c7a21672482354 *R/examples/logLik_examples.R | ||
02000462392443088a7b9628b773cd8a *R/examples/nobs_examples.R | ||
6b09738c1f2d641ebc62d78f2d335119 *R/examples/nobs_examples.R | ||
982d834e7e7c3fdf1a1c0190a6f46bd9 *R/examples/plot_lm_loglik_examples.R | ||
8bbfa2ac0a52f0be3d68985b972e0ea3 *R/examples/predict_examples.R | ||
014ab1c3a4fb3f2511a5df2dbe775723 *R/examples/residuals_examples.R | ||
ef613a5445aeaf5860f2c5fe24ea69b8 *R/examples/summary_examples.R | ||
2139927b488f26929811b608c885885f *R/examples/vcov_examples.R | ||
65c5d7d3efb959034969ce25081d0525 *R/fisher.R | ||
55710a0dc6e13d24c95ebd093a0cc634 *R/fitted.lmvar.R | ||
76d53c81c09306d3c6f9d9ab2720861c *R/fwbw.R | ||
056de7c2348c29e24f9427c01f92d5a6 *R/fwbw.lm.R | ||
b6aba946b99d5ab4fb8509b78e8c6093 *R/fwbw.lmvar.R | ||
a9491ae6286b3abd51633b501b4421b0 *R/fisher.R | ||
ca2ecc92ec74ce5e1772529bc9ec772b *R/fitted.lmvar.R | ||
8758cca999e5b006d4b7f9a81c7c71ef *R/fwbw.R | ||
db27e9d0c8e3dbe463b523ae1c987180 *R/fwbw.lm.R | ||
af8dc2a225899fad889071e1582e4ba2 *R/fwbw.lmvar_no_fit.R | ||
d97d4f2dd4613ba9af5c79e8c683d4b7 *R/gaussian_var.R | ||
2ad52fdbc43ab3c4307a0c7451301116 *R/lmvar.R | ||
5e8c6c2298c0e6f8456fb9c4ba94f7e1 *R/lmvar.R | ||
9579f496fa27f431642516fa710d233e *R/lmvar_no_fit.R | ||
8a5f8803d15359cd28f236e6a59d3d1d *R/logLik.lmvar.R | ||
e5cf148c174d648f080d175de6193a60 *R/make_matrix_full_rank.R | ||
cd8a438e6f4d4458598f14f385ca60a1 *R/make_matrix_full_rank.default.R | ||
b1ae7360f0cdf66e3eb8322a0e682d51 *R/make_matrix_full_rank.qr.R | ||
ce35ea079b9ea28fca1c413ba974790e *R/make_matrix_full_rank.sparseqr.R | ||
0f757f89e1585e36f19ecdfcd2be0e55 *R/make_matrix_full_rank.sparseqr.R | ||
f3288867bdf9afe76559cb414d136f40 *R/matrix_column_names.R | ||
4f63ac17353588bd3d9497d181ace9cb *R/nobs.lmvar.R | ||
d09df1dc05ba530d47ecef7ad48f4807 *R/nobs.lmvar_no_fit.R | ||
5668d333949fd9a3e2cf8099b4f1e603 *R/order_10.R | ||
6058d2bc592acc833c64e36b1284ede9 *R/plot_lm_loglik.R | ||
576c8f6c982e185744f840ebf9594d5e *R/predict.lmvar.R | ||
e9b6a2bd7ebec9dfe9f6221112b8db99 *R/print.cvlmvar.R | ||
91b511de7be5344bb6eb5ea5e7e2ed69 *R/print.cvlmvar.R | ||
7cd1d6d1d15de59cc06d82fe4e2ffae0 *R/print.summary_lmvar.R | ||
68ba53a968caa6fc52a96117a4b2a537 *R/residuals.lmvar.R | ||
a57fc156653d7c9ed6179fc3068774d1 *R/round_to_sd_accuracy.R | ||
da4359eb750fb52cb6f5913f4d34f8f3 *R/summary.lmvar.R | ||
7edbf99718bd27c73eef02ba0b3962bf *R/vcov.lmvar.R | ||
e4c8237c288027acdfbbff7b085b7e2f *README.md | ||
8c53f40ce779bcb91efd666d99c94436 *build/vignette.rds | ||
53a0a56108ded09b0576e9dce23fa7fb *R/summary.lmvar.R | ||
4a911bd1219a39c7ca8408ebb5c6ca0a *R/vcov.lmvar.R | ||
4e1b39c7885a8b4b83ae560a184a9e5b *README.md | ||
a198a5c97f310d864b076bae2e2b38d8 *build/vignette.rds | ||
f82e1918a45923e06c52f5e55835e713 *inst/doc/Intro.R | ||
3f28d9c0733d19e3ce0a6396832665e2 *inst/doc/Intro.Rmd | ||
ae5249a0a4dc5d00c470d00ddaf27121 *inst/doc/Intro.html | ||
30cacce24029165a47ad57078be7c082 *inst/doc/Math.ltx | ||
2aaff8ee1e29c7dfd486da3ab9a9b65f *inst/doc/Math.pdf | ||
54f125c9c4dd72e6226fdccdaa14dee9 *inst/doc/Intro.Rmd | ||
32b0eb5b34cb60bd4ab4eb9e37d62cf7 *inst/doc/Intro.html | ||
d14af0a8f0cc7cd7096c4d68cff40a9c *inst/doc/Math.ltx | ||
07024a16f969facb22ae41e3e0003d60 *inst/doc/Math.pdf | ||
cdc8775371ef46701cbbfdd098441d22 *man/AIC.lmvar.Rd | ||
40be9e23383ce6cfb87f6158572eab2e *man/alias.lmvar.Rd | ||
9155d6d400a240a721c21b9fcd3f2600 *man/alias.lmvar_no_fit.Rd | ||
96870ffeb6e33b5476b9014730e99d0f *man/beta_sigma_names.Rd | ||
080d71de1dad4ff42e68810ec5e3c56f *man/coef.lmvar.Rd | ||
eda5d04e9440ca14271b251dbc23b0a4 *man/cv.lm.Rd | ||
194343163cc18b220ac7779ebb479cf8 *man/cv.lmvar.Rd | ||
d728f54df747c77aa92e6dc2c20e1897 *man/dfree.Rd | ||
a5e5ccd1c0fafcdaee3bbeb7cab47cd5 *man/fisher.Rd | ||
e7644d21028376eabaaa0d6be23001d3 *man/fitted.lmvar.Rd | ||
48b61963e666087c40453b34bcd2f59e *man/fwbw.Rd | ||
2767d53d216092f2fcc458bd6d698bf2 *man/fwbw.lm.Rd | ||
618a816bc8e66bdaa03bbdca3c91e485 *man/fwbw.lmvar.Rd | ||
ff64c128f2e97962b98c5bcac72bee22 *man/lmvar.Rd | ||
21f8b67c390611bbaba18e7e8a08b389 *man/cv.lm.Rd | ||
13cf16bd81673c937478dc3fccc53602 *man/cv.lmvar.Rd | ||
1f23082551603052841421c699e04695 *man/dfree.Rd | ||
2841cd34efa9a37ee83c2f831e790859 *man/fisher.Rd | ||
731b8ccbc9a0ffd0e2d1f879a7b34d1c *man/fitted.lmvar.Rd | ||
8ccc2d718aa8d9918fbccc7b5a20ec50 *man/fwbw.Rd | ||
63139890a9ffd9f1c93e1c814f8341e0 *man/fwbw.lm.Rd | ||
2e95d75eadf3cd8f07698f5fc0f327a9 *man/fwbw.lmvar_no_fit.Rd | ||
f4be60c654357a66c092e6c6db62d032 *man/lmvar.Rd | ||
54d6a4f3a24741f8b8188763d8c1d02e *man/lmvar_no_fit.Rd | ||
d3041936af6e96cdc0ae4464e0f52796 *man/logLik.lmvar.Rd | ||
c33fe1105392aeab24e540c8f09459a4 *man/nobs.lmvar.Rd | ||
092345fcff1e6e8f50a906608fe1e0c6 *man/nobs.lmvar_no_fit.Rd | ||
ec03ba6d5de9d5be935003325e2103b8 *man/plot_lm_loglik.Rd | ||
f7d8f046405077977aeeff7a3e9ab0e5 *man/predict.lmvar.Rd | ||
ae4ae2b043239120febca0d18f449c99 *man/print.cvlmvar.Rd | ||
080d695ec1395b492167dbf7e898c71a *man/print.summary_lmvar.Rd | ||
9b35a0b154bc37c64d22c063fe84850e *man/residuals.lmvar.Rd | ||
7fca9ba8b3a74e8447ce5e544f35fb7e *man/summary.lmvar.Rd | ||
869b39bcf7108f031d972e1883df6a22 *man/vcov.lmvar.Rd | ||
1c0ecff7c342cb941990a9e41ff2eeaa *man/summary.lmvar.Rd | ||
4fc6426dd6c460f89da7c2d655cd3010 *man/vcov.lmvar.Rd | ||
cbc022948d6c0009e705b9f0111937cf *tests/testthat.R | ||
2240bdeb95bf161a84eb0780c4f55a4f *tests/testthat/helper.R | ||
6a3c1e1754a425df52885f76e6efe33b *tests/testthat/test_cross_validations.R | ||
9181c1bb3ff9b24d1d5da2dcf1a0ce1e *tests/testthat/test_extractors.R | ||
f9c3bdb716810b6674fd79b18a44c2e4 *tests/testthat/test_fwbw.R | ||
0904e44a027ff53c93eb48cd7b7ff128 *tests/testthat/test_extractors.R | ||
da092f43aa741122767a3b28f9fb6475 *tests/testthat/test_fwbw.R | ||
662b803897ac92828a7d5368f62f7e45 *tests/testthat/test_gradient_and_hessian.R | ||
1fc85f6a930d7cb215c91afc563c4b8d *tests/testthat/test_lmvar.R | ||
d3438cc41b003a1a791f90464d9310b3 *tests/testthat/test_lmvar.R | ||
c1c85a254392910637cb73094a56e120 *tests/testthat/test_lmvar_no_fit.R | ||
2de1a3ebd02098ee93f67c401f92d281 *tests/testthat/test_predict.R | ||
3f28d9c0733d19e3ce0a6396832665e2 *vignettes/Intro.Rmd | ||
30cacce24029165a47ad57078be7c082 *vignettes/Math.ltx | ||
54f125c9c4dd72e6226fdccdaa14dee9 *vignettes/Intro.Rmd | ||
d14af0a8f0cc7cd7096c4d68cff40a9c *vignettes/Math.ltx | ||
3bdf41fcf4a9097ce1e06f5367c48ea9 *vignettes/bibliography.bib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# As example we sue the dataset 'iris' from the library 'datasets' | ||
library(datasets) | ||
|
||
# Create the model matrix for both the expected values and the standard deviations | ||
X = model.matrix( ~ Species - 1, data = iris) | ||
|
||
# Take as response variabe the variable Sepal.length | ||
y = iris$Sepal.Length | ||
|
||
# Construct a 'lmvar_no_fit' object | ||
no_fit = lmvar_no_fit( y, X, X) | ||
|
||
# The following functions all work on such an object | ||
nobs(no_fit) | ||
dfree(no_fit) | ||
alias(no_fit) | ||
|
||
# You can also supply 'lmvar' arguments | ||
no_fit = lmvar_no_fit( y, X[,-1], X[,-1], intercept_mu = FALSE, intercept_sigma = FALSE) | ||
dfree(no_fit) | ||
|
||
# Some (most) arguments have no effect except that they are stored in the 'lmvar_no_fit' | ||
# object | ||
no_fit = lmvar_no_fit( y, X, X, control = list( slvr_log = TRUE, remove_df_sigma = TRUE)) | ||
no_fit$control |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
\dontrun{ | ||
|
||
# Carry out a linear regression with the 'iris' data set | ||
fit = lm( Petal.Length ~ Species, data = iris, x = TRUE, y = TRUE) | ||
X = fit$x | ||
y = fit$y | ||
|
||
# We center the plot at the maximum-likelihood | ||
beta_or = coef(fit) | ||
|
||
# Plot the maximum log-likelihood | ||
lmvar:::plot_lm_loglik( y, X, beta_or = beta_or, beta_x = "(Intercept)", | ||
beta_y = "Speciesversicolor") | ||
|
||
# Plot against the two species | ||
lmvar:::plot_lm_loglik( y, X, beta_or = beta_or, beta_x = "Speciesversicolor", | ||
beta_y = "Speciesvirginica") | ||
|
||
# Increase the resolution | ||
lmvar:::plot_lm_loglik( y, X, beta_or = beta_or, beta_x = "Speciesversicolor", | ||
beta_y = "Speciesvirginica", plot_points = 40) | ||
|
||
# Remove the intercept term from the model matrix and fit again | ||
XX = X[,-1] | ||
fit = lm( y ~ . - 1, data = as.data.frame(XX)) | ||
|
||
# Estimate the effect of adding an intercept term in a quadratic approximation and compare | ||
# with exact result | ||
beta_or = c( 0, coef(fit)) | ||
lmvar:::plot_lm_loglik( y, X, beta_or = beta_or, beta_x = 1, beta_y = "Speciesversicolor", | ||
add_qa = TRUE, plot_points = 40, plot_width = 5) | ||
|
||
# Note that in the last case the quadratic approximation has no maximum. Hence the beta for | ||
# "Speciesvirginica" is kept at beta_or[3] in the calculation of the surface of the | ||
# quadratic approximation. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.