由买买提看人间百态

topics

全部话题 - 话题: preds
1 2 3 下页 末页 (共3页)
c****s
发帖数: 63
1
请问,如果用SAS fit logistic regression做预测,最后将pred(Y)跟实际(Y)在一个
图里比较,是先画一个pred(Y)的hitogram,然后再画另一个,放在一起呢,还是怎样呢?
请问这个code怎么写?
非常感谢!!
c****s
发帖数: 63
2
比较pred(Y)跟实际(Y)的match情况,因为logistic regression 结果都是1,0, 所以
应该怎么比呢?
w******a
发帖数: 25
3
来自主题: Statistics版 - imputation question?thanks
Here is an R example to impute one or two missing data in each record:
The data will look like
col1 col2 col3
x
x x x
x x
x x
x x x
x
x x x
...
library(Rlab)
alp = 1
K_delta = 2
len_Y1 = 200
#Sample setting:
#Measurment N_
patient Percent
# 1 12
0.18
# 1 2 4
0.05... 阅读全帖
w********9
发帖数: 8613
4
来自主题: Military版 - 惊讶于德国人的英语能力
这是Shorter Oxford American English Dictionary第五版列出的与德语或者日耳曼语
相关的英语词根或词汇。
-at, suffix2. + -dom, suffix. + -ed, suffix1. + -ed, suffix2. + -en, suffix1
+ -en, suffix2 + -en, suffix5 + -en, suffix6 + -er, suffix1. + -er, suffix3
. + -er, suffix5. + -est, suffix1. + -est, suffix2. + -et, suffix2. + -eth,
suffix1. + -hood, suffix. + -ing, suffix1. + -ing, suffix3. + -ish, suffix1.
+ -kin, suffix. + -le, suffix1 + -le, suffix3 + -less, suffix. + -ling,
suffix1. + -ling, suffix2 + -ly, suffix1. + -ly, s... 阅读全帖
f*******n
发帖数: 2665
5
来自主题: Statistics版 - 问一个关于R 的问题
多谢!!!下面是我写的function, output 是一个list,包含两项,一个是AUC,另
一个是pred, 是prediction()的结果。 function和output 都没有问题。可是我需要
用plot(performance(pred,...)),而pred是list,类型不符,这个问题如何解决?请
赐教!
modelscore<- function(model) {
pr <- predict(rpart, newdata=newdata[ , c(input, target)])[,2]
# ignore missing target values.
no.miss <- na.omit(newdata[ , c(input, target)]$goodbad)
miss.list <- attr(no.miss, "na.action")
attributes(no.miss) <- NULL
if (length(miss.list)) {
pred <- prediction(pr[-miss.list], no.miss)
} else ... 阅读全帖
m*******d
发帖数: 19
6
来自主题: Pharmaceutical版 - 国内医药行业最新动向信息速递
我来clarify一下.
pRED: Roche Pharmar Research and Early Development
gRed: Genentech Research and Early development.
pRED and gRED are two totally independent research and early development
organizations that are co-existing inside Roche, pRED includes all research
and early development organizations worldwide other than Genentech (gRED).
Both gRED and pRED are running drug discovery effort before phase 2 pivot
trials or phase 3 trials. Please note both in-vivo and in-vitro studies
belong to RED effo... 阅读全帖
z**k
发帖数: 378
7
来自主题: Statistics版 - Adaboost M1 - what's wrong with this code?
My understanding is, for Adaboost M1, the loss function mean(-y*F) is always
strictly decreasing, but this is not the case for the following code. Can
anyone help?
I m following the example of Hastie ESL-II chapter 10.1.
sorry cannot type Chinese here. Thank you very much for help.
#================R Script====================
## Data using example given in T. Hastie, ESL, chapter 10.1
dta <- matrix(rnorm(20000), 2000, 10)
pred <- apply(dta, 1, function(x) sum(x^2))
y <- (pred > qchisq(0.5, 10))... 阅读全帖
l******g
发帖数: 1623
8
来自主题: Pharmaceutical版 - GNE vs Roche
是生物制药胜了传统制药, 还是其他原因?
http://in.reuters.com/article/2012/07/03/us-roche-genentech-idI
(Reuters) - When Roche paid $46.8 billion in 2009 to gain full ownership of
Genentech, fears were rife that the arrival of the Swiss men in suits would
stifle the free-wheeling innovative culture at the California-based biotech.
Three years on, however, the jeans-wearing scientists in San Francisco have
proven they are the ones driving the drugs pipeline of the 116-year-old
Basel-based pharma giant, casting a sh... 阅读全帖
G***G
发帖数: 16778
9
来自主题: Biology版 - ordered label in ROCR
I don't understand how to order the label in ROCR package in order to
get the correct result. I am wondering whether you can help me.
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
svm.auc <- performance(pred, 'tpr', 'fpr')
plot(svm.auc)
#####label
ROCR.simple$labels[ROCR.simple$labels=="0"]="tumor"
ROCR.simple$labels[ROCR.simple$labels==1]="normal"
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
svm.auc <- performance(pred, 'tpr', ... 阅读全帖
f***a
发帖数: 329
10
来自主题: Statistics版 - How to fit a smoothed line in R?
### adjust parameter to meet your needs, hehe :)
#data
y <- c(100,150,160,200,300,290,350,400,450,399,500,1500)
x <- 1:12
nx <- seq(1,12,by=0.1)
plot(x,y,type="b")
#poly
tt <- lm(y~poly(x,10))
lines(nx,predict(tt,newdata=data.frame(x=nx)),col=2)
#loess
lsm<-loess.smooth(x,y,span=1/2)
lines(lsm,col=2)
lsm1<-loess(y~x,span=1/4)
pred<-predict(lsm1,newdata=nx,se=TRUE)
lines(nx,pred$fit,col=4)
lines(nx,pred$fit-1.96*pred$se.fit,lty=2)
#supsmu
lsmsup<-supsmu(x,y)
lines(lsmsup,col=2)
plot(x, y)
for(i i
G***G
发帖数: 16778
11
来自主题: Statistics版 - ordered label in ROCR
I don't understand how to order the label in ROCR package in order to
get the correct result. I am wondering whether you can help me.
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
svm.auc <- performance(pred, 'tpr', 'fpr')
plot(svm.auc)
#####label
ROCR.simple$labels[ROCR.simple$labels=="0"]="tumor"
ROCR.simple$labels[ROCR.simple$labels==1]="normal"
pred <- prediction(ROCR.simple$predictions,ROCR.simple$labels)
svm.auc <- performance(pred, 'tpr', ... 阅读全帖
n*********e
发帖数: 318
12
I am doing an R logistic regression exercise -
My question is - 是否要先从validation set 中删掉 dependent variable, 然后再 run
prediction?
谢谢。
--------------------
library(MASS)
attach(birthwt) #The famous 'low birth weight' data for logistic regression
index <- 1:dim(birthwt)[1]
test<- sample(index, trunc(length(index)/3))
train<-birthwt[-test,]
validation <- birthwt[test,]
logit.1<-glm(low~., data=train, family=binomial(link='logit'))
logit.1
#------------------------------
#这里是否要先从validation set 中删掉 dep... 阅读全帖
w*******9
发帖数: 1433
13
来自主题: Statistics版 - 请问回归结果的置信区间
有一定的道理,取决于你怎么取c,但肯定不是1.96或qt(0.975,df)。
这样看,你如何预测新的y呢?一个reasonable的预测可以是pred.y=hat.beta*x0+
epsilon,这里hat.beta (could be a vector) 是估计的beta,x0是你想了解的subject
的covariate,epsilon是和hat.beta独立的扰动。这样你
取pred.y的variance, more precisely, the estimated variance, 就是 x0'Var(hat.
beta)x0+MSE, 这个var(hat.beta)~MSE*(H(x) -- something related to the design
matrix), so var(pred.y)=MSE(1+x0'*H(x)*x0). So if you could choose c
according to var(pred.y), you'll get what the textbook tells us.
If I fail to make the poi... 阅读全帖
f*******n
发帖数: 2665
14
来自主题: Statistics版 - 问一个关于R 的问题
这是程序和错误信息,多谢!
> modelscore<- function(model, newdata) {
+ pr <- predict(rpart, newdata=newdata[ , c(input, target)])[,2]
+ # ignore missing target values.
+ no.miss <- na.omit(newdata[ , c(input, target)]$goodbad)
+ miss.list <- attr(no.miss, "na.action")
+ attributes(no.miss) <- NULL
+ if (length(miss.list)) {
+ pred <- prediction(pr[-miss.list], no.miss)
+ } else {
+ pred <- prediction(pr, no.miss)
+ }
+
+ auc<-performance(pred,'auc')@y.values[[1]]
+
+ newlist<-list(pred,auc)
+ return (newlist... 阅读全帖
s******1
发帖数: 39
15
请教高手,下面这一段R code 是什么意思?谢谢
getLMOutFunc = function(lmOut){
highSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] + coef(lmOut)[,"
Estimate"][["pred"]]
lowSEL = coef(lmOut)[,"Estimate"][["(Intercept)"]] - coef(lmOut)[,"
Estimate"][["pred"]]
sampleN = as.numeric(lmOut[["ngrps"]])
if(coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]]<.05) {
sig = coef(lmOut)[row.names(coef(lmOut))=="pred",][[4]]
} else {
sig = "ns"
}
return(list("High SEL" = highSEL, ... 阅读全帖
l*********d
发帖数: 78
16
来自主题: JobHunting版 - Google onsite归来
参照 peking2 的写了一个:
public Iterator conditionIterator(final Iterator input,
final Predicate pred) {
return new Iterator() {
T next = null;
public T next() {
if (!hasNext()) throw new NoSuchElementException("no more element");
T ret = next;
next = null;
return ret;
}
public boolean hasNext() {
if (next != null) return true;
else if (!input.hasNext()) return false;
... 阅读全帖
p*****2
发帖数: 21240
17
来自主题: JobHunting版 - 问道G 的题
class NewIterator
{
Iterator input;
Predicate pred;
T next;
boolean valid;
public NewIterator(Iterator _input, Predicate _pred)
{
input=_input;
pred=_pred;
}
public boolean hasNext()
{
if(!valid)
{
while(input.hasNext())
{
T t=input.next();
if(pred.accept(t))
{
next=t;
valid=true;
b... 阅读全帖
R*****i
发帖数: 2126
18
来自主题: JobHunting版 - 一道老题目, 求最快捷解法
这个题目建议用红黑树做可能最快捷有效。红黑树每一次插入,删除都是log(k),求平
均值非常简单,就是根部的那个节点。所以总的计算量是O(nlog(k))。
以下是c/c++代码(需要修改数组,以便一个一个输入)。
#include
#include
#include
#define INDENT_STEP 4
enum rbtree_node_color {RED, BLACK};
typedef struct rbtree_node_t {
int value;
struct rbtree_node_t* left;
struct rbtree_node_t* right;
struct rbtree_node_t* parent;
enum rbtree_node_color color;
} *rbtree_node;
typedef rbtree_node node;
typedef enum rbtree_node_color color;
typedef struct... 阅读全帖
m*****f
发帖数: 4970
19
来自主题: pets版 - 最近很郁闷。 。。
谢谢大家。 开药的vet 周一才上班, 他的同事回我email, 说吃pred 的确很容易得
demodectic mange。 毛也会掉很多。 如果他的脚好多了, 可以慢慢减量吃一半pred
, 然后慢慢不吃。 吃完了pred 应该毛会慢慢长好, demodectic mange 也会自己愈
合。 可以用oatmeal shampoo 帮 odie 洗澡, 不过毛还是会继续掉的。
下周末我爸妈要来了, 因为odie 生病我们把出去玩的行程砍了一半, 因为这样子没
法boarding. odie 要拖个破脚, 顶着张阴阳脸见人了~~
q*********i
发帖数: 696
20
来自主题: Statistics版 - 弱问个用R fit GLM的问题
有一组数据,k是trial的次数,y是success的次数,pred是唯一的predictor
每个observation的trial次数都不一样。
R代码写成下面这样可以吗?
glm (y/k~pred,binomial(link = "logit"), weights =k)

glm (y/k~pred,binomial(link = "logit"))
看了半天help也没看明白weights参数在这里的意思,试着fit了一下两个命令得到的参
数差不多。deviance和AIC都是有weight的那个小一些。
w*******9
发帖数: 1433
21
你要每个individual整个的predicted survival curve的话,在newdata里只要加上
covariates就行,去掉individual=TRUE. For example, pred<-survfit(model,
newdata) plot(pred). 要得到10年survival prob., 你得自己从pred$surv里去取。
另外你有3000个features, 你怎么降维的?
f*******n
发帖数: 2665
22
来自主题: Statistics版 - 问一个关于R 的问题
我刚开始学R,知道的class也就有dataframe, list之类的,下面的pred(pred <-
prediction())是什么class类型?
> class(pred)
[1] "prediction"
attr(,"package")
[1] "ROCR"
s******1
发帖数: 39
23
请问高手, 这样计算cohen's D, effect size对吗?
modOut = lm(GPA ~ IEP + FRL + ELL + pred, data=reg2data)
out = summary(modOut)
cohensd = coef(out)[,"Estimate"][["pred"]]/ sd(predict(modOut))
看起来cohen's D= "'pred'的regression coefficient" 除以 "回归模型的预测值"的
standard deviation.
请问这样计算cohen's D 对吗?
R*****n
发帖数: 8658
24
来自主题: _Xiyu版 - 公司大裁员
讲个故事
roche买genentech的时候, 号称要保持research方面的独立, 所以我们这边early
development and research就叫gRed, roche以前的类似的部门就叫pRED,
pRed那边大概有3000人, 结果这次gred不动, pred要裁掉600人, 有些area就完全停掉
了...
所以我们经常的问题是, 到底谁买了谁
D********g
发帖数: 650
25
来自主题: JobHunting版 - Google onsite归来
面经回馈本版,只列出technical question.
P1:
A. Add next pointer to each node on a BTree to its next sibling on the same
level.
B. Boggle题,find all possible words from a 2D character array.
P2:
A. Given
interface Iterator {
T next();
boolean hasNext();
}
interface Predicate {
boolean accept(T t);
}
Implement a method that creates an "accept" iterator that returns items
accepted by the passedin pred variable.
Iterator conditionIterator(Iterator input, Predicate pred) {
}
B. Concurren... 阅读全帖
p*****2
发帖数: 21240
26
来自主题: JobHunting版 - Google onsite归来

我写了一个。
Iterator it=null;
Predicate pr=null;
T next=null;
Iterator conditionIterator(Iterator input, Predicate pred)
{
it=input;
pr=pred;
hasNext();
}
T next()
{
T ret=next;
hasNext();
return ret;
}
T hasNext()
{
if(next==null)
{
while(it.hasNext())
{
next=it.hasNext();
if(pr.accept(next))
break;
else
next=null;
}
}
return next!=null;
}
b********g
发帖数: 43
27
来自主题: JobHunting版 - Google onsite归来
我的理解是每次都预读一个next, 然后就ok 了
Iterator it = null;
Predicate pr = null;
T next =null;
Iterator conditionIterator(Iterator input, Predicate pred)
{
it = input;
pr = pred;
next();
}
T next() {
T ret = next;
bool found = false;
while(it.hasNext()) {
T val = it.next();
if(pr.accept(val)){
next = val;
found = true;
break;

}
if(!found) next = NULL;
return ret;
}
bool hasnext() {
return !next;
}
h*****g
发帖数: 312
28
来自主题: JobHunting版 - 问道G 的题
A. Given
interface Iterator {
T next();
boolean hasNext();
}
interface Predicate {
boolean accept(T t);
}
Implement a method that creates an "accept" iterator that returns items
accepted by the passedin pred variable.
Iterator conditionIterator(Iterator input, Predicate pred) {
}
这题撒意思?需要设计模式的背景知识吗?
l*********8
发帖数: 4642
29
来自主题: JobHunting版 - 问道G 的题
class ConditionIterater : public Iterator
{
public:
ConditionIterater(Iterator input, Predicate pred)
: m_Input(input), m_Pred(pred), m_HasNext(false)
{
}
T Next()
{
T returnValue = m_Value;
finxNext();
return returnValue;
}
bools hasNext()
{
return m_HasNext;
}
private:
void findNext()
{
m_HasNext = false;
while(m_Input.hasNext())
{
m_Value = m_Input.Next();
if (m_Pred.accept(m_Value) {
... 阅读全帖
l*********8
发帖数: 4642
30
来自主题: JobHunting版 - 问道G 的题
根据peking2的程序和建议改一下:)
class ConditionIterater : public Iterator
{
public:
ConditionIterater(Iterator input, Predicate pred)
: m_Input(input), m_Pred(pred), m_HasNext(false)
{
findNext();
}
T Next()
{
if (m_HasNext==false)
throw exception;
T returnValue = m_Value;
fintNext();
return returnValue;
}
inline bools hasNext()
{
return m_HasNext;
}
private:
void findNext()
{
m_HasNext = false;
while(m_Input.... 阅读全帖
w******y
发帖数: 4871
31
来自主题: NextGeneration版 - 悲催求祝福,不到一天背靠背两次ER
this is what those "smart" people usually do.
Let me give you an example why I do not think patient should seek medical
advice here.
A patient's post on online forum: I have allergies, nose congestion, always
got sinus infection, headache, but no wheezing now, and currently i am on
Dulera and albuterol. what should I do.
reply from A: you dont have wheezing, try to not to use Dulera
reply from B: you need to see your doctor
reply from C: try some vitamin D.
reply from D,E,F: blah, blah, blah,
I ... 阅读全帖
j******a
发帖数: 186
32
来自主题: Hockey版 - Bruins is done!!!
Ward是今年从Preds签的。被人认为way over price。去年他在Preds对Canucsks的系列
中表现特别好,所以才拿了大合同。不过常规赛打得很差,终于季后赛又继续为新主立
功了。
w*******e
发帖数: 2405
33
自己update一下,半年来,又去看过几次医生,pred基本上已经开始失效,从1天两次
降为一天一次的时候就情况开始反复,带了collar,也不能阻止小白去舔那一块
期间也换了处方猫粮,发现不是食物的原因
兽医让我们去皮肤科专门的兽医那里做测试,不一定能找出原因,估计又是个无底洞,
我们已经在这上面花了快1000了,就没有去
后来听人说用红霉素药膏,我们从一个星期前开始用(当时把pred等口服药完全停了想
看看红霉素药膏的效果),一天1-2次,用药膏前先用酒精消毒,然后薄薄的涂一层红
霉素药膏,涂好药膏后抱着他一会儿,同时带collar防止舔药膏
到现在一个星期了,原本2-3 平方厘米的感染区,现在只剩2-3个绿豆大的小块块没有
愈合,其他的白毛又都长来了,现在就是继续用药,希望能把这个病治好,其实不是什
么大毛病,就跟人的皮肤病湿疹似的,但是就是烦心的很,要治好了就好了
b******a
发帖数: 12216
34
☆─────────────────────────────────────☆
waterrose (水玫瑰) 于 (Mon Dec 27 13:45:10 2010, 美东) 提到:
自己update一下,半年来,又去看过几次医生,pred基本上已经开始失效,从1天两次降为一天一次的时候就情况开始反复,带了collar,也不能阻止小白去舔那一块
期间也换了处方猫粮,发现不是食物的原因
兽医让我们去皮肤科专门的兽医那里做测试,不一定能找出原因,估计又是个无底洞,我们已经在这上面花了快1000了,就没有去
后来听人说用红霉素药膏,我们从一个星期前开始用(当时把pred等口服药完全停了想看看红霉素药膏的效果),一天1-2次,用药膏前先用酒精消毒,然后薄薄的涂一层红霉素药膏,涂好药膏后抱着他一会儿,同时带collar防止舔药膏
到现在一个星期了,原本2-3 平方厘米的感染区,现在只剩2-3个绿豆大的小块块没有愈合,其他的白毛又都长来了,现在就是继续用药,希望能把这个病治好,其实不是什么大毛病,就跟人的皮肤病湿疹似的,但是就是烦心的很,要治好了就好了
j*****u
发帖数: 186
35
下面程序来自于essential C++ 3.6节,给定一个数组,输出比某个数小的所以元素。
main函数中用了back_inserter,按道理是不是应该include iterator头文件和
using std::back_inserter? 但是为什么把这两句注释掉程序也能跑呢?谢谢。
===================================================================
#include
#include
#include
#include
#include
//#include
using std::vector;
using std::cout;
using std::endl;
using std::less;
//using std::back_inserter;
template 阅读全帖
j*****u
发帖数: 186
36
下面程序来自于essential C++ 3.6节,给定一个数组,输出比某个数小的所以元素。
main函数中用了back_inserter,按道理是不是应该include iterator头文件和
using std::back_inserter? 但是为什么把这两句注释掉程序也能跑呢?谢谢。
===================================================================
#include
#include
#include
#include
#include
//#include
using std::vector;
using std::cout;
using std::endl;
using std::less;
//using std::back_inserter;
template 阅读全帖
d******i
发帖数: 7160
37
just check. u r right.
the MSDN's really confusing about the pop_heap:
"
pop_heap
template
void pop_heap(RanIt first, RanIt last);
template
void pop_heap(RanIt first, RanIt last, Pred pr);
The first template function reorders the sequence designated by iterators in
the range [first, last) to form a new heap, ordered by operator< and
designated by iterators in the range [first, last - 1), leaving the original
element at *first subsequently at *(last -... 阅读全帖
H**********J
发帖数: 351
38
Primary Responsibilities and Accountabilities:
On the ED Core Team
• Represents medical science on ED Teams to
o ensure alignment on strategy between ED and LIP Criteria
o support target and clinical candidate selection (in collaboration with
Clinical Pharmacologist)
o provide guidance on benefit/risk assessment and risk mitigation
activities (responsibility shared with Clinical Pharmacologist)
• Is accountable for the overall design and the clinical and
scientific c... 阅读全帖
H**********J
发帖数: 351
39
来自主题: Biology版 - 请教Bioinformatics职业规划~~~
回国的话,我可以帮得上忙,^_^
Provide primary informatics support to the Disease & Translational Areas (
DTA) and Translational Research Sciences (TRS) in Shanghai. The candidate
will be expected to:
1. Liaise with scientific contacts in both discovery and translational
areas within the DTA and TRS organizations to understand informatics
requirements, identify technical solutions and partner with local and global
informatics teams to deliver projects
2. Must be able to analyze, model and optimize workf... 阅读全帖
H**********J
发帖数: 351
40
工作内容如下:
Provide primary informatics support to the Disease & Translational Areas (
DTA) and Translational Research Sciences (TRS) in Shanghai. The candidate
will be expected to:
1. Liaise with scientific contacts in both discovery and translational
areas within the DTA and TRS organizations to understand informatics
requirements, identify technical solutions and partner with local and global
informatics teams to deliver projects
2. Must be able to analyze, model and optimize workflows, dev... 阅读全帖
l**g
发帖数: 698
41
来自主题: Pharmaceutical版 - 国内医药行业最新动向信息速递
我当然知道啦
R和PRED还不是同一个概念呢
D是PDY Y是亚洲的意思,
D是做pharma development的,是in vivo
R做的都是in vitro
R原来就是罗氏的嫡系,罗氏自己的研发
pred是09年并购genentech之后,主要力量都是genentech的
至于你说的研发中心,我想提醒你一点,PD不是药品研发,是药品开发
然后你提到的informatics,罗氏本身的informatics,针对PD的那个team,本身就是
global team
有些信息不是你自己认为准确,就全部准确了的
我都不能确保上面那些信息说得全对一点错处都没有
Q****h
发帖数: 41
42
来自主题: Pharmaceutical版 - 国内医药行业最新动向信息速递

Give me a break! Genentech 的研发is gred, not pred. pred is 罗氏的嫡系.
Please do not misleading the other people.
b*****a
发帖数: 905
43
来自主题: Statistics版 - How to do ROC curve in R?
lz自己挑著看吧。
## Make a ROC plot to see the ration of the rate of false positives to the
rate of false negatives
library(ROCR)
ip.glm<-glm(votesum ~ clint96 + partyid + aflcio97 + ccoal98, data=ip,
family=binomial(link=logit))
summary(ip.glm)
names(ip.glm)
pred.object<-prediction(ip.glm$fitted.values, ip.glm$y)
perf.object<-performance(pred.object, "tpr", "fpr")
# use add=TRUE as an argument to the plot() function if you want to overlay
additional ROC plots.
# Compare the model with submodel (Democr
w******a
发帖数: 25
44
来自主题: Statistics版 - imputation question?thanks
Here is an R example to impute one missing data in each record,half of the code is to make data sample, you probably only need second half,but including them here helps you understand what is going on:
The data will look like
col1 col2
x
x x
x
x x
x x
...
library(Rlab)
alp = 1
Prob_R1 = 0.5
Prob_R0 = 1 - Prob_R1
len_Y1 = 200
K_delta = 2
Y1 = rnorm(len_Y1,mean=0,sd=1)
R1 = rbinom(n=len_Y1, size=1, prob=Prob_R1)
Y2 = rnorm(n=len_Y1,... 阅读全帖
j******4
发帖数: 6090
45
来自主题: Statistics版 - 哪位用R做过CART MODEL
嗯。。。好像之前的pred这个要先定义成vector,长度就是你testdata的长度,比如你
testdata
是个86*50的矩阵,那么你的pred要先定义成vector(length=86)因为你最后要得到86
个预测的
结果。
c**********e
发帖数: 2007
46
来自主题: Statistics版 - Question Proc GENMOD
I am running on the GENMOD. The data set is simple repeated measure.
The code is following.
proc genmod data=one;
class ... ...;
model ... ...;
repeated subject=id / type=exch;
output out = Residuals
pred = Pred
resraw = Resraw
reschi = Reschi
resdev = Resdev
stdreschi = Stdreschi
stdresdev = Stdresdev
reslik = Reslik;
run;
The weird thing is that the follo... 阅读全帖
l***y
发帖数: 184
47
来自主题: Statistics版 - 求助一个R的错误提示
用R的时候,fit 一个model,然后去求test error, 出现了一个错误提示,看不懂,
也没有google出来,是这样的:
一下是PCA的后半部分,前半部分太长了,就不贴了,
x.score <- x.train.center %*% x.svd$v
n.score<-nrow(x.score)
y=y.train
library(boot)
set.seed(1)
nfolds<-5
folds<-split(sample(n.score),rep(1:nfolds,length=n.score))
train <- data.frame(y=y.train,x.score)
ols.model<-glm(y~.,data=train)
cost <- function(y, y.hat) mean((y.hat>.5)!=y)
test.error.ols <- rep(NA, 256)
for(i in 1:256){
pc.pred <- predict(ols.model,x.test,n.score=i)
test.error.ols[i]... 阅读全帖
s******1
发帖数: 39
48
非常感谢,
下面是 regression model 部分:
用学生情商(pred)来预测学生GPA, IEP(学生残疾Y/N), FRL(学生低收入Y/N), ELL(学
生英语非母语Y/N)
lmOut = lm(GPA ~ IEP + FRL + ELL + pred, data=reg2data)
m*******x
发帖数: 59
49
各位大侠:
你们好!
我在用R做Time Series predict,但是老是 “unused argument (level = 95)”不知道
什么是unused argument (level = 95)?我换了level=90,Or 80 还是不行!
我的data是:
Year RelativeSurvivalRate
1975W-male 41.7
1975W-female 56.9
1975B-male 32.6
1975B-female 45.6
1976W-male 42.8
...
2009-female 60.7
R code is:
...
> pred<-forecast(A,h=4,level=95);pred
Error in forecast(A, h = 4, level = 95) : unused argument (level = 95)
先跪谢大侠们了!
m********t
发帖数: 13072
50
来自主题: Military版 - 吗公的脑袋被驴踢了吧
忘了说,那个年代,中国就走美国和日本的pred-med路线了, 本硕连读, 还没真正
对外开放呢
共产党NB不?
1 2 3 下页 末页 (共3页)