[英]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. 我是R.的新手。我想使用“pls”包对我的数据进行偏最小二乘分析。
The data information is design elements, whether exist or not, in 0 and 1 and the last column contains the emotion score. 数据信息是设计元素,无论是否存在,在0和1中,最后一列包含情绪分数。 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")
plsr(密度〜NIR,6,数据= mydata,验证=“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") 这适用于我(我下载了你的pastebin并将其保存为名为“junk.dat”的文件)
dat <- read.csv("junk.dat")
library("pls")
summary(plsr(Adorable~.,data=dat))
The formula Adorable~.
配方
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. 说
Adorable
(你的最后一个列名)是响应变量,数据框中的所有剩余列都应该用作预测变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.