How to use pamr function in R?
0
0
Entering edit mode
3.9 years ago

I'm using pamr function for training my model and thereby predicting on my test data. I have written the code but I'm not sure if my code is correct or not? Please give valuable feedback.

library(pamr)

data1 <- read.table("DISCOVERY_INPUT.txt",sep="\t")
vecto <- scan("DISC_LABELS.txt", character(), quote = "")

mydata <- list(x=data1,y=vecto)
mytrain <-   pamr.train(mydata)
mycv <- pamr.cv(mytrain,mydata)

pamr.plotcv(mycv)

####Testing with my trained model object on test data##
newx1 <- as.matrix(read.table("CELL_LINE_INPUT.txt",sep="\t"))
prediction_result <- pamr.predict(mytrain, newx1, threshold = 1.5)
View(prediction_result)

Input Data:

DISC_LABELS (Here 1,2,3 represents cluster class in which our samples are present)
2   1   1   2   1   3   1   1   3   1   1   2   2   1   3   1   2   1   1   3

DISCOVERY_INPUT

0.226914999 0.17475025  0.223162558 0.268781674 0.276437497 0.157510059 0.202060238 0.168054062 0.223642002 0.144085457 0.155465769 0.131518003 0.188500606 0.275243912 0.178517605 0.164768752 0.169705693 0.114435576 0.13449927  0.143942181

CELL_LINE_INPUT (My test data/cell line data)

0.275104129 0.296965021 0.311240317 0.291522787 0.477223901 0.38288832  0.257801771 0.569291942 0.280361337 0.477443593 0.356490082 0.664772161 0.46293188  0.334071418 0.32811604  0.384570387 0.332922032 0.283945342 0.29626007  0.347386226 0.31456261  0.289693393 0.278474175 0.322551733 0.309029375 0.38502583  0.451128247 0.293995882 0.350323047 0.322005762 0.356336858 0.431325481 0.338219893 0.460566981 0.314755048 0.268779623 0.300202576 0.399101138 0.368131084 0.403293509 0.445137823 0.292816452 0.357048084 0.243247269 0.360730309 0.361357446 0.519835095 0.280882086 0.282587769 0.378009164 0.31190293
R software error • 747 views
ADD COMMENT

Login before adding your answer.

Traffic: 1772 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6