Skip to content

Error When More Covariates Than Response Variables #13

@CZUBRYTT

Description

@CZUBRYTT

Hello. When using the pcev package, I get an error when the number of covariates (q) is larger than the number of response variables (p). As you can see in the output below, the error message I get when calling computePCEV(Y, X) is "Error in weights[, 2:(ncol(pcevObj$X) - 1), drop = FALSE]: subscript out of bounds". Is there a reason why PCEV shouldn't be used when q > p, or is there an error in the package? Thank you.

# Attach pcev package
    library(pcev)
    
    # Define dimensions
    p <- 2 # Number of response variables
    q <- 3 # Number of covariates
    n <- 100 # Number of observations
    
    # Generate response matrix and covariate matrix
    set.seed(10)
    Y <- matrix(rnorm(n * p), nrow = n, ncol = p) # Response variables
    X <- matrix(rnorm(n * q), nrow = n, ncol = q) # Covariates
    
    # Attempt to perform PCEV on Y and X
    pcev_out <- computePCEV(Y, X)
#> Error in weights[, 2:(ncol(pcevObj$X) - 1), drop = FALSE]: subscript out of bounds

Created on 2020-07-06 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions