简体   繁体   中英

Partial Least Square Regression using R

I'm new to R. I want to use the "pls" package to do Partial Least Square Analysis on my data.

The data information is design elements, whether exist or not, in 0 and 1 and the last column contains the emotion score. I want to find the design elements that contribute to the emotion.

From example that I found on the internet, I need to call

> plsr(density ~ NIR, 6, data=yarn, validation="CV")

When I try this:

plsr(density ~ NIR, 6, data=mydata, validation="CV")

I get this error:

Error: object 'NIR' not found

How do I call the function correctly using my data?

Thank you in advance

This works for me (I downloaded your pastebin and saved it as a file called "junk.dat")

dat <- read.csv("junk.dat")
library("pls")
summary(plsr(Adorable~.,data=dat))

The formula Adorable~. says that Adorable (your last column name) is the response variable and that all of the remaining columns in the data frame should be used as predictors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM