[R] Regarding R doubt

2019-06-19 Thread shr...@outlook.com
Hello Team,
I hope you are doing well.
I have one doubt about backend functioning of R command.
Currently I'm working on IRT analysis in python but this function is 
implemented in R and in R they have direct rasch model library but no such 
library in the Python.

So I wanted to know that is there any way to find the math or formula behind 
the specific command of R language.
for eg, summary(PL2.rasch)
after this command you will directly get difficulty and discrimination values 
like mentioned below:

Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
Dffclt.V3   -1.3585   3.2062 -0.4237
Dffclt.V4   -1.00328649.3103 -0.0001
Dffclt.V50.04001350.8452  0.

So is there any way to find out the math behind this summary command ?

Thanks,
Shreepad



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding R doubt

2019-06-21 Thread shr...@outlook.com
library(ltm)
library(psych)

setwd("C:/Users/Admin/Desktop/IRT_CatSim")

irtdat<-read.csv("Fresh_r_2pl.csv",header=F)
head(irtdat)
PL2.rasch<-ltm(irtdat~z1)
summary(PL2.rasch)

plot(PL2.rasch,type=c("ICC"))
plot(PL2.rasch,type=c("IIC"))


Above is the code,When I run summary(PL2.rasch) I will get the following table 
directly:
Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
�
Discrm.V1   -1.3585   3.2062 -0.4237
Discrm.V1   -1.00328649.3103 -0.0001
�

Working on Item response theory and I�m struggling at calculating above values 
manually.
You will get this difficulty and discrimination values directly, I just want 
the simple formulas to calculate item difficulty and item discrimination.
Also how they have calculated theta(ability) and scores at the backend of the 
code.


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


From: Richard O'Keefe 
Sent: Thursday, June 20, 2019 2:18:26 AM
To: shr...@outlook.com
Cc: r-help@r-project.org
Subject: Re: [R] Regarding R doubt

You did not say what your doubt about R was.
PL2.rasch has some class.
> class(PL2.rasch)
[1] 'Grofnigtz'   # or whatever
The summary function is really just a dispatcher.
> summary.Grofnigtz
... a listing comes out here ...

Or you could look in the source code of whatever package you are usin.


On Thu, 20 Jun 2019 at 00:25, shr...@outlook.com<mailto:shr...@outlook.com> 
mailto:shr...@outlook.com>> wrote:
Hello Team,
I hope you are doing well.
I have one doubt about backend functioning of R command.
Currently I'm working on IRT analysis in python but this function is 
implemented in R and in R they have direct rasch model library but no such 
library in the Python.

So I wanted to know that is there any way to find the math or formula behind 
the specific command of R language.
for eg, summary(PL2.rasch)
after this command you will directly get difficulty and discrimination values 
like mentioned below:

Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
Dffclt.V3   -1.3585   3.2062 -0.4237
Dffclt.V4   -1.00328649.3103 -0.0001
Dffclt.V50.04001350.8452  0.

So is there any way to find out the math behind this summary command ?

Thanks,
Shreepad



[[alternative HTML version deleted]]

__
R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding R doubt

2019-06-21 Thread shr...@outlook.com
Thank you so much for the help !

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


From: Richard O'Keefe 
Sent: Thursday, June 20, 2019 10:41:49 AM
To: shr...@outlook.com
Cc: r-help@r-project.org
Subject: Re: [R] Regarding R doubt

And PL.rasch has what class?
The manual for the 'ltm' package says that 'summary'
"[s]ummarizes the fit of either grm, ltm, rasch or tpm objects."

Download the sources from 
https://cran.r-project.org/src/contrib/ltm_1.1-1.tar.gz
Unpack the sources.  Look at ltm/R/summary.rasch.R
as that *computes* the summary and ltm/R/print.summ.rasch.R
as that *prints* the summary.

R is a wonderful wonderful tool with a great community and many fine 
statisticians
contributing code.  Statisticians are not software engineers, so it is no
reflection on the professional competence of the author to say that neither of
these files has any comments.  On the other hand, the code is not very complex.
The files are about one page each.

On Thu, 20 Jun 2019 at 15:49, shr...@outlook.com<mailto:shr...@outlook.com> 
mailto:shr...@outlook.com>> wrote:
library(ltm)
library(psych)

setwd("C:/Users/Admin/Desktop/IRT_CatSim")

irtdat<-read.csv("Fresh_r_2pl.csv",header=F)
head(irtdat)
PL2.rasch<-ltm(irtdat~z1)
summary(PL2.rasch)

plot(PL2.rasch,type=c("ICC"))
plot(PL2.rasch,type=c("IIC"))


Above is the code,When I run summary(PL2.rasch) I will get the following table 
directly:
Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
�
Discrm.V1   -1.3585   3.2062 -0.4237
Discrm.V1   -1.00328649.3103 -0.0001
�

Working on Item response theory and I�m struggling at calculating above values 
manually.
You will get this difficulty and discrimination values directly, I just want 
the simple formulas to calculate item difficulty and item discrimination.
Also how they have calculated theta(ability) and scores at the backend of the 
code.


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

____
From: Richard O'Keefe mailto:rao...@gmail.com>>
Sent: Thursday, June 20, 2019 2:18:26 AM
To: shr...@outlook.com<mailto:shr...@outlook.com>
Cc: r-help@r-project.org<mailto:r-help@r-project.org>
Subject: Re: [R] Regarding R doubt

You did not say what your doubt about R was.
PL2.rasch has some class.
> class(PL2.rasch)
[1] 'Grofnigtz'   # or whatever
The summary function is really just a dispatcher.
> summary.Grofnigtz
... a listing comes out here ...

Or you could look in the source code of whatever package you are usin.


On Thu, 20 Jun 2019 at 00:25, shr...@outlook.com<mailto:shr...@outlook.com> 
mailto:shr...@outlook.com>> wrote:
Hello Team,
I hope you are doing well.
I have one doubt about backend functioning of R command.
Currently I'm working on IRT analysis in python but this function is 
implemented in R and in R they have direct rasch model library but no such 
library in the Python.

So I wanted to know that is there any way to find the math or formula behind 
the specific command of R language.
for eg, summary(PL2.rasch)
after this command you will directly get difficulty and discrimination values 
like mentioned below:

Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
Dffclt.V3   -1.3585   3.2062 -0.4237
Dffclt.V4   -1.00328649.3103 -0.0001
Dffclt.V50.04001350.8452  0.

So is there any way to find out the math behind this summary command ?

Thanks,
Shreepad



[[alternative HTML version deleted]]

__
R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] FW: IRT discrimination value (ltm and psych package)

2019-06-25 Thread shr...@outlook.com


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


From: shr...@outlook.com
Sent: Tuesday, June 25, 2019 10:57:30 AM
To: Eric Berger
Subject: IRT discrimination value (ltm and psych package)

Hello Sir,
I am learning R and its syntax and  I have successfully converted 
irt.item.diff.rasch into python code and pass the inputs as per the function 
made in R.

In R  :-
function (items)
{
  ncases <- nrow(items)
  item.mean <- colMeans(items, na.rm = TRUE)
  item.mean[item.mean < (1/ncases)] <- 1/ncases
  irt.item.diff.rasch <- log((1/item.mean) - 1)
}

In Python :-
def diff(items):
item_mean= items.mean()
item_diff = []
for i in item_mean:
diff = np.log((1/i)-1)
item_diff.append(diff)
return item_diff


I am getting the exact same result as R output.
But I�m still unable to understand the �item.discrim� and how to and what to 
pass as a input to the function,

function (item.diff, theta, items)
{
  irt.item.discrim <- function(x, diff, theta, scores) {
fit <- -1 * (log(scores/(1 + exp(x * (diff - theta))) +
  (1 - scores)/(1 + exp(x * (theta - diff)
mean(fit, na.rm = TRUE)
  }
  nitems <- length(item.diff)
  discrim <- matrix(NaN, nitems, 2)
  for (i in 1:nitems) {
item.fit <- optimize(irt.item.discrim, c(-5, 5), diff = item.diff[i],
  theta = theta, scores = items[, i])
discrim[i, 1] <- item.fit$minimum
discrim[i, 2] <- item.fit$objective
  }
  irt.discrim <- discrim

Could you please guide how do I convert the same in python, because there are 
no proper explanation in documentation what to pass as following arguments or 
the formulas to find the values of x and theta.
X= ?
Diff = I got the diff values
Theta = ?
Scores = = items[, i] as per mentioned in code

Unable to find theta and x, please help with this parameters ?



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.