matloff / matloff/polyreg

Problem running examples

Open
#17 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
183
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Dear Normal Matloff,

I have been trying out your R package, however I am having trouble getting the examples provided in the readme file to work.

Code:

Working part:
`> getPE()

pe <- pe[,c(1,2,4,6,7,3)]
head(pe,2)
age sex wkswrkd ms phd wageinc
1 50.30082 0 52 0 0 75000
2 41.10139 1 20 0 0 12300

pfout <- polyFit(pe,2) # quadratic model
getPoly time: 0.021 0.003 0.024 0 0
lm() time: 0.02 0.004 0.027 0 0
newx <- pe[1,] # dummy 1-row data frame
newx <- newx[,-6] # no Y value
newx$age <- 40
newx$sex <- 1
newx
age sex wkswrkd ms phd
1 40 1 52 0 0
`

However, when I run predict() I get the following error:
Called from: predict.polyFit(pfout, newx) Browse[1]> c model.matrix() reported the following error: Error : $ operator is invalid for atomic vectors

R session:
`

sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] C/UTF-8/C/C/C/C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rpart_4.1-13 polyreg_0.4.0 regtools_1.0.0 car_3.0-2
[5] carData_3.0-2 dummies_1.5.6 mvtnorm_1.0-8 FNN_1.1.3
[9] tidyquant_0.5.5 quantmod_0.4-13 TTR_0.23-4 PerformanceAnalytics_1.5.2
[13] xts_0.11-0 zoo_1.8-3 lubridate_1.7.4 gtrendsR_1.4.2
[17] BatchGetSymbols_2.3 rvest_0.3.2 xml2_1.2.0 forcats_0.4.0
[21] stringr_1.3.1 dplyr_0.8.0.1 purrr_0.3.0 readr_1.3.1
[25] tidyr_0.8.1 tibble_2.0.1 ggplot2_3.1.0 tidyverse_1.2.1
[29] devtools_1.13.6

loaded via a namespace (and not attached):
[1] nlme_3.1-137 httr_1.3.1 tools_3.4.2 backports_1.1.2 utf8_1.1.4 R6_2.4.0
[7] lazyeval_0.2.1 colorspace_1.3-2 nnet_7.3-12 withr_2.1.2 tidyselect_0.2.5 curl_3.3
[13] compiler_3.4.2 git2r_0.23.0 cli_1.0.1 keras_2.2.4 scales_1.0.0 quadprog_1.5-5
[19] tfruns_1.4 digest_0.6.18 foreign_0.8-71 rio_0.5.16 base64enc_0.1-3 pkgconfig_2.0.2
[25] rlang_0.3.1 readxl_1.3.0 pdist_1.2 rstudioapi_0.9.0 generics_0.0.2 jsonlite_1.6
[31] tensorflow_1.10 zip_1.0.0 magrittr_1.5 Matrix_1.2-14 Rcpp_1.0.0 Quandl_2.9.1
[37] munsell_0.5.0 fansi_0.4.0 abind_1.4-5 reticulate_1.10 partools_1.1.6 stringi_1.2.4
[43] whisker_0.3-2 yaml_2.2.0 kerasformula_1.5.1 plyr_1.8.4 grid_3.4.2 parallel_3.4.2
[49] crayon_1.3.4 lattice_0.20-35 haven_2.0.0 hms_0.4.2 zeallot_0.1.0 pillar_1.3.1
[55] glue_1.3.0 data.table_1.12.0 modelr_0.1.2 cellranger_1.1.0 gtable_0.2.0 assertthat_0.2.0
[61] openxlsx_4.1.0 broom_0.5.0 RSpectra_0.13-1 memoise_1.1.0 deepnet_0.2
`

Any idea whats going on?
Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the README example with polyFit(pe, 2), the one-row newx data frame, and predict.polyFit(pfout, newx) under the reported R session. Trace the predict.polyFit entry point and model.matrix error; done means prediction succeeds for the shown newx input without the atomic-vector error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.